DataInputStream Read Method -- Is Offset From Start of File or Last Read?
From: Hal Vaughan (hal_at_thresholddigital.com)
Date: 11/27/04
- Next message: Andrew Thompson: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Previous message: Andrew Thompson: "Re: java graphic problem"
- Next in thread: Andrew Thompson: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Reply: Andrew Thompson: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Reply: Chris Smith: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Reply: Oscar kind: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 27 Nov 2004 10:20:04 -0500
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
- Next message: Andrew Thompson: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Previous message: Andrew Thompson: "Re: java graphic problem"
- Next in thread: Andrew Thompson: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Reply: Andrew Thompson: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Reply: Chris Smith: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Reply: Oscar kind: "Re: DataInputStream Read Method -- Is Offset From Start of File or Last Read?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|