I am currently using this:
Path path = Paths.get("c:\test\test.txt");
byte[] all= Files.readAllBytes(path);
The problem with this is that I have to load the entire file in memory. My requirement is to read the file byte by byte, but in a manner like first 4 bytes mean X, next 16 bytes mean Y and use next 48 bytes for Z, etc.
Right now I am looping through all to do this.. My current code has a pointer which I am moving till all.length
and using Arrays.copyOfRange
to copy parts to other arrays for use. I am interested in knowing about BufferedReaders
which reads a few bytes and then I can process them.