Java - IO - Byte Stream

Java Conceptuel Diagram


Byte I/O Operations (Stream) in java

Programs use byte streams to perform input and output of 8-bit bytes.

Super Classes

All byte stream classes are descended from this two class:

  • input stream to read byte or byte array (buffer). All implementations extends the InputStream abstract class.
  • output stream to write byte or byte array (buffer). All implementations extends the OutputStream abstract class.

Implementation Level

High Level (Stream)

All streams are from the Java IO package.

Byte Stream

All other stream types are built on byte streams.

Stream Operations Logical Unit Description
FileInputStream Read Byte A FileInputStream read one byte at a time.
FileOutputStream Write Byte A file output stream write to a File or to a FileDescriptor one byte at a time.

FileInputStream and FileOutputStream use an int variable to read to and write from.

in = new FileInputStream(Parameters.FILE_PATH_READ);
int c =;

It holds a byte value in its last 8 bits. (In character stream, the int holds a character in its last 16 bits).

Buffered Byte Stream

Stream Operations Logical Unit Description
ByteArrayInputStream Read Buffer (ByteArray) A ByteArrayInputStream contains an internal buffer that contains bytes that may be read from the stream.
ByteArrayOutputStream Write Buffer (ByteArray) This class implements an output stream in which the data is written into a byte array.
BufferedInputStream Read Buffer (ByteArray) A BufferedInputStream adds functionality on buffer streams-namely, the support the mark and reset methods.
BufferedOutputStream Write Buffer (ByteArray) The class implements a buffered output stream.

Piped Byte Stream

Stream Operations Logical Unit Description
PipedInputStream Pipe Read Na A piped input stream should be connected to a piped output stream; the piped input stream then provides whatever data bytes are written to the piped output stream.
PipedOutputStream Pipe Write Na A piped output stream can be connected to a piped input stream to create a communications pipe.

Random Access Byte Stream

Stream Operations Logical Unit Description
RandomAccessFile Pointer Read/Write Byte of Array Instances of this class support both reading and writing to a random access file.

Low Level (FileChannel)

FileInputStream, FileOutputStream and RandomAccessFile can return a FileChannel for low-level I/O.

The channels class are from the Java NIO Package.

Documentation / Reference

Discover More
Java Conceptuel Diagram
Java - IO - Buffer Streams

Without buffer, each read or write request is handled directly by the underlying OS. This can make a program much less efficient, since each such request often triggers: disk access, network activity,...
Java Conceptuel Diagram
Java - IO - Character Stream

Character streams are build above byte stream. They decodes bytes into characters (or the other way around) using a specified charset. The Java platform stores character values using Unicode conventions....
Java Fileiomethods
Java - IO - Connection (Stream and Channel)

in Java. In order to perform I/O operations (for example reading or writing), you need to perform a connection. In Java, this connection are modelled through: a stream ( package) or a channel...
Java Conceptuel Diagram
Java - IO - Standard Streams

in Java. For historical reasons, Standard Streams are byte streams and not character streams System.out and System.err are defined as java/io/PrintStreamPrintStream objects. PrintStream is technically...

Share this page:
Follow us:
Task Runner