Input and Output Streams |
UseByteArrayInputStream
andByteArrayOutputStream
to read and write 8-bit data. Create these streams on an existing byte array and then use theread
andwrite
methods to read from or write data to the array in memory.Use
StringBufferInputStream
to read data from aStringBuffer
. Create aStringBufferInputStream
on an existingStringBuffer
object and then use theread
method to read from theStringBuffer
as it lives in memory. This stream is similar to theByteArrayInputStream
which reads 8-bit data from a byte array in memory butStringBufferInputStream
reads 16-bit Unicode data from a string buffer in memory. Thejava.io
package does not have a partner output stream forStringBufferInputStream
--use theStringBuffer
class directly instead.
Input and Output Streams |