Character Array and String I/O

The CharArrayReader and CharArrayWriter classes are similar to the ByteArrayInputStream and ByteArrayOutputStream classes in that they support I/O from memory buffers. The difference between these classes is that CharArrayReader and CharArrayWriter support 16-bit character I/O, and ByteArrayInputStream and ByteArrayOutputStream support 8-bit byte array I/O.

The CharArrayReader class does not add new methods to those that Reader provides. The CharArrayWriter class adds the following methods to those provided by Writer:

  • reset()— Resets the buffer so that it can be read

  • size()— Returns the current size of the buffer

  • toCharArray()— Returns a character array copy of the output buffer

  • toString()— Copies and converts ...

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.