Byte Array I/O

Java supports byte array input and output via the ByteArrayInputStream and ByteArrayOutputStream classes. These classes use memory buffers (arrays) as the source and destination of the input and output streams. The contents of the memory buffers are written and read from the streams. The StringBufferInputStream class is similar to the ByteArrayInput class, but was deprecated in JDK 1.1. The StringReader class is now the preferred class for String-based input.

The CharArrayReader, CharArrayWriter, StringReader, and StringWriter classes support character-based I/O in a manner similar to the ByteArrayInputStream, ByteArrayOutputStream, and StringBufferInputStream classes. They are covered later in this chapter.

The ByteArrayInputStream ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.