Hello!
I've got a big file on which I'm opening a FileInputStream. This file contains some files each having an offset from the beginning and a size. Furthermore I've got a parser that should evaluate such a contained file.
File file = ...; // the big file
long offset = 1734; // a contained file's offset
long size = 256; // a contained file's size
FileInputStream fis = new FileInputStream(file );
fis.skip(offset);
parse(fis, size);
public void parse(InputStream is, long size) {
// parse stream data and insure we don't read more than size bytes
is.close();
}
I feel like this is no good practice. Is there a better way to do this, maybe using buffering?
Furthermore I feel like the skip() method slows the reading process a lot.
Thanks in advance! :-)