Previous | Next | Trail Map | Writing Java Programs | Input and Output Streams


Using Streams to Read and Write Memory Locations (1.1notes)

Use ByteArrayInputStream(in the API reference documentation) and ByteArrayOutputStream(in the API reference documentation) to read and write 8-bit data. Create these streams on an existing byte array and then use the read and write methods to read from or write data to the array in memory.

Use StringBufferInputStream(in the API reference documentation) to read data from a StringBuffer. Create a StringBufferInputStream on an existing StringBuffer object and then use the read method to read from the StringBuffer as it lives in memory. This stream is similar to the ByteArrayInputStream which reads 8-bit data from a byte array in memory but StringBufferInputStream reads 16-bit Unicode data from a string buffer in memory. The java.io package does not have a partner output stream for StringBufferInputStream--use the StringBuffer class directly instead.


Previous | Next | Trail Map | Writing Java Programs | Input and Output Streams