I'm writing a program that reads a file (uses custom buffer, 8KB), then finds a keyword in that buffer. Since Java provides two type of streams: character & byte, I've implemented this using both byte[]
and char[]
for buffering.
I just wonder, which would be faster and better for performance, since a char
is 2 byte
and when using Reader
to read up char[]
, the Reader
will perform converting back from byte
to char
, which I think could make it slower than using only byte[]
.