Byte Stream Hierarchy in Java

Hierarchy Structure

InputStream Hierarchy

Byte Stream Hierarchy in Java

Classes
Class Description
InputStream This abstract class is the superclass of all classes representing an input stream of bytes.
ByteArrayInputStream It extends InputStream. A ByteArrayInputStream contains an internal buffer that contains bytes that may be read from the stream.
FileInputStream It extends InputStream. A FileInputStream obtains input bytes from a file in a file system.
FilterInputStream It extends InputStream. A FilterInputStream contains some other input stream, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.
BufferedInputStream It extends FilterInputStream. A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the mark and reset methods. When the BufferedInputStream is created, an internal buffer array is created. As bytes from the stream are read or skipped, the internal buffer is refilled as necessary from the contained input stream, many bytes at a time. The mark operation remembers a point in the input stream and the reset operation causes all the bytes read since the most recent mark operation to be reread before new bytes are taken from the contained input stream.
DataInputStream It extends FilterInputStream. A data input stream lets an application read primitive Java data types from an underlying input stream in a machine-independent way. An application uses a data output stream to write data that can later be read by a data input stream.
DataInputStream is not necessarily safe for multithreaded access. Thread safety is optional and is the responsibility of users of methods in this class.
LineNumberInputStream It extends FilterInputStream. This class is an input stream filter that provides the added functionality of keeping track of the current line number.

@deprecated This class incorrectly assumes that bytes adequately represent
characters. As of JDK 1.1, the preferred way to operate on
character streams is via the new character-stream classes, which
include a class for counting line numbers.

PushbackInputStream It extends FilterInputStream. A PushbackInputStream adds functionality to another input stream, namely the ability to “push back” or “unread” one byte. This is useful in situations where it is convenient for a fragment of code to read an indefinite number of data bytes that are delimited by a particular byte value; after reading the terminating byte, the code fragment can “unread” it, so that the next read operation on the input stream will reread the byte that was pushed back. For example, bytes representing the characters constituting an identifier might be terminated by a byte representing an operator character; a method whose job is to read just an identifier can read until it sees the operator and then push the operator back to be re-read.
ObjectInputStream It extends InputStream. An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream.
PipedInputStream It extends InputStream. 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.
SequenceInputStream It extends InputStream. A SequenceInputStream represents the logical concatenation of other input streams. It starts out with an ordered collection of input streams and reads from the first one until end of file is reached, whereupon it reads from the second one, and so on, until end of file is reached on the last of the contained input streams.
StringBufferInputStream This class allows an application to create an input stream in which the bytes read are supplied by the contents of a string. Applications can also read bytes from a byte array by using a ByteArrayInputStream.
Only the low eight bits of each character in the string are used by this class.This class is Deprecated.
This class does not properly convert characters into bytes. As of JDK 1.1, the preferred way to create a stream from a string is via the StringReader class.
OutputStream Hierarchy

OutputSream-Hierarchy

Classes
Class Description
OutputStream This abstract class is the superclass of all classes representing an output stream of bytes. An output stream accepts output bytes and sends them to some sink.
ByteArrayOutputStream It extends OutputStream. This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it. The data can be retrieved using toByteArray() and toString().
FileOutputStream It extends OutputStream. A file output stream is an output stream for writing data to a File or to a FileDescriptor.
FilterOutputStream It extends OutputStream. This class is the superclass of all classes that filter output streams. These streams sit on top of an already existing output stream (the underlying output stream) which it uses as its basic sink of data, but possibly transforming the data along the way or providing additional functionality.
BufferedOutputStream It extends FilterOutputStream. The class implements a buffered output stream. By setting up such an output stream, an application can write bytes to the underlying output stream without necessarily causing a call to the underlying system for each byte written.
DataOutputStream It extends FilterOutputStream. A data output stream lets an application write primitive Java data types to an output stream in a portable way. An application can then use a data input stream to read the data back in.
PrintStream It extends FilterOutputStream. A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently.
ObjectOutputStream It extends OutputStream. An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream. The objects can be read (reconstituted) using an ObjectInputStream.
PipedOutputStream It extends OutputStream. A piped output stream can be connected to a piped input stream to create a communications pipe. The piped output stream is the sending end of the pipe.

Leave a Reply

Your email address will not be published. Required fields are marked *