A stream in Java can be a file you read/write sequentially, a set of bytes in RAM (Random Access Memory) you read/write sequentially or a flow of bytes to an Internet socket you read or write. You can skip forward with skip or DataInputStream.skipBytes, but you cannot go back. There is no getFilePointer() to tell you how many bytes you have written to the stream as there is with RandomAccessFile. You can process the stream as encoded bytes with a Reader/Writer. You can process the stream as binary fields with a DataInputStream/DataOutputStream. You can process the stream as serialized objects with an ObjectInputStream/ObjectOutputStream. Streams can be buffered or unbuffered. With unbuffered streams, usually you do your i/o a whole file at a time or in great whacking hunks. You also use it for tiny files.
Here are classes that will be helpful in working with streams. See the FileIO amanuensis for detailed help in using them.
This page is posted |
http://mindprod.com/jgloss/stream.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\stream.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[3.22.68.29] |
| |
Feedback |
You are visitor number | |