Performing I/O in Java

This section shows how to perform several important tasks in Java using streams and Readers and Writers, including

  • Byte-oriented I/O

  • I/O with Java Primitives

  • Write and read lines of text

  • Write and read entire objects

Performing I/O Using FileInputStream and FileOutputStream: Code Example

FileInputStream and FileOutputStream are the basic, concrete classes for doing I/O. Despite their names, you do not need to use them for writing to or reading from files as such. You should select the stream, Reader, or Writer that you want to use based on the granularity or level of abstraction you want to work at. You choose FileInputStream and FileOutputStream to work at the byte level. Listing 12.3 shows a simple example of using these ...

Get PURE Java™ 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.