| Input and Output Streams

## Using Streams to Read and Write Memory Locations

> Use ByteArrayInputStream and ByteArrayOutputStream to read and write 8-bit data. You 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 to read data from a StringBuffer. You create a StringBufferInputStream on an existing StringBuffer object and then use the `read()` methods 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--you can use the StringBuffer class directly instead.

> #### See Also

> > java.io.ByteArrayInputStream
> > java.io.ByteArrayOutputStream
> > java.io.StringBufferInputStream

| Input and Output Streams