In this section we will discussed the I/O Byte Streams.
This Stream handles the 8-bit binary input/output of data. Byte streams are used where the program needs to work with the raw binary data. In Java to handle I/O raw binary data the byte stream classes are defined. For all of the byte stream classes InputStream and OutputStream are the root classes.
An image given below demonstrate the class hierarchy of Byte Stream classes.

Classes of byte stream
InputStream : An abstract super class of all the classes which represents the input data as byte (8-bit).
Methods of InputStream
Some subclasses of the InputStream class are as follows :
| Byte Stream Classes | Description |
| FileInputStream | FileInputStream takes input bytes from a file. |
| ByteArrayInputStream | A ByteArrayInputStream can retain bytes read from the input stream using its internal buffer |
| SequenceInputStream | The input streams can be logically concatenated using SequenceInputStream. |
| StringBufferInputStream | The string's content supplies bytes read to an input stream which is created by an application.
The StringBufferInputStream class allows an application to do this. |
| FilterInputStream | It has some additional input stream used as basic data source, these input streams can provide transformation of data and extra functionality. |
| DataInputStream | It allows an application to read java's data type using an input stream which is independent of machine. |
| BufferedInputStream | It provides additional functionality to the input stream such as capability to buffer. It also supports reset and mark methods. |
| PipedInputStream | The data byte written on piped output stream is provided by PipedInputStream. But before that it must connect to the piped output stream. |
| PushbackInputStream | To sum up the ability to "push back" or "unread" one byte to other input stream, a PushbackInputStream is used. |
OutputStream : An abstract super class of all the classes which represents the output data as byte (8-bit).
Methods of OutputStream
Some subclasses of OutputStream class are as follows :
| Byte Stream Classes | Description |
| FileOutputStream | FileOutputStream is used write data to a File or to a FileDescriptor. |
| ByteArrayOutputStream | ByteArrayOutputUsingStream provides the facility to write data into a byte array using the output stream. |
| FilterOutputStream | All the classes that filter output streams is the subclasses of the FilterOutputStream superclass. |
| DataOutputStream | It allows an application to write java's data type(primitive) to an output stream. |
| BufferedOutputStream | The BufferedOutputStream provides the facility to contains the byte into the buffered output stream. |
| PrintStream | It provide ability to the other output stream to print several data value's representation. |
| PipedOutputStream | For creating communication pipe, piped output stream should be connected to piped input stream. |
For detail description please visit the java doc of java.io package
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java I/O Byte Streams
Post your Comment