Hal Vaughan
2004-11-27 15:20:04 UTC
If I have a DataInputStream (called dis) wrapped around a FileInputStream,
when I do this:
dis.read(byteInput, 0, intLength);
if intLength is set to the entire length of the file, it reads the full
file. Now here's the question: If, instead of reading the file all at
once, I have a loop that reads more whenever more is written, I've noticed
that when I keep the offset at 0, each read picks up where the last one
left off. Is that correct behavior, or am I doing something wrong? I
didn't see mention of this in my books or in the Sun tutorials. I'm not
clear if the offset is bytes from the start of the file, or bytes from the
end of the last read (with the same open DataInputStream).
Could someone clarify whether the offset is always supposed to be from the
beginning of the file, or from the end of the last read operation?
Thanks!
Hal
when I do this:
dis.read(byteInput, 0, intLength);
if intLength is set to the entire length of the file, it reads the full
file. Now here's the question: If, instead of reading the file all at
once, I have a loop that reads more whenever more is written, I've noticed
that when I keep the offset at 0, each read picks up where the last one
left off. Is that correct behavior, or am I doing something wrong? I
didn't see mention of this in my books or in the Sun tutorials. I'm not
clear if the offset is bytes from the start of the file, or bytes from the
end of the last read (with the same open DataInputStream).
Could someone clarify whether the offset is always supposed to be from the
beginning of the file, or from the end of the last read operation?
Thanks!
Hal