Disk IO -> RAM optimisation?

Once I have loaded a file in my inputstream, should I copy the contents of th stream into a character buffer or a string?

I believe it’s more efficient (processing wise) to use a string over a character buffer.

I realise the size of the string is the amount of characters is in it + 1. A character[] doesn’t have that disadvantage but I hardly think that 1 byte is going to make a large difference. I’m trying to keep my file processing to an all time low.

Am I right and I should go with a string over a char[] buffer?

Thank You

A String is a char[] so I don’t see there being any differance.

What are you optimizing, and why?

Thanks. I’m trying to make the IO disk(HD) operations fast. So I don’t have to wait long to load files up into a string.

Don’t use inputstreams then, use NIO and map the file directly or read into a CharBuffer.

It depends what you want to do with it once you’ve read it.

CAs :slight_smile:

Just display it on screen. :slight_smile:

Thanks