Classes and Interfaces of Java I/O Streams

The java.io package contains a number of classes, interfaces and exceptions. They will be needed in program development related to Java I/O and File  operations. Their descriptions are given below.

 

Java I/O Classes

The following listings of classes of java.io package shown in the table:

Class
Description

BufferedInputStream

It used for creating an internal buffer array. It supports the mark and reset methods.

BufferedOutputStream

This class used for writes byte to output stream. It implements a buffered output stream.

BufferedReader

This class provides read text from character input stream and buffering characters. It also reads characters, arrays and lines.

BufferedWriter

This class provides write text from character output stream and buffering characters. It also writes characters, arrays and lines.

ByteArrayInputStream

It contains the internal buffer and reads data from the stream.

ByteArrayOutputStream

This class used for data is written into byte array. This is implemented in output stream class.

CharArrayReader

It used for char input stream and implements a character buffer.

CharArrayWriter

This class also implements a character buffer and it uses a writer.

DataInputStream

This class reads the primitive data types from the input stream in a machine format.

DataOutputStream

This class writes the primitive data types from the output stream in machine format.

File

This class shows a file and directory pathnames.

FileDescriptor

This class uses for create a FileInputStream and FileOutputStream.

FileInputStream

It contains the input byte from a file and implements an input stream.

FileOutputStream

It uses for writing data to a file and also implements an output stream.

FilePermission

It provides the permission to access a file or directory.

FileReader

This class used for reading characters file.

FileWriter

This class used for writing characters files.

FilterInputStream

This class overrides all methods of InputStream and contains some other input stream.

FilterOutputStream

This class overrides all methods of OutputStream and contains some other output stream.

FilterReader

It reads the data from the filtered character stream.

FilterWriter

It writes data from the filtered character stream.

InputStream

This class represents an input stream of bytes.

InputStreamReader

It reads bytes and decodes them into characters.

LineNumberReader

This class has a line numbers

ObjectInputStream

This class used for recover the object to serialize previously.

ObjectInputStream.GetField

This class access to president fields read form input stream.

ObjectOutputStream

This class is used for write the primitive data types and also write the object to read by the ObjectInputStream.

ObjectOutputStream.GetField

This class access to president fields write in to ObjectOutput.

ObjectStreamClass

Serialization’s descriptor for classes.

ObjectStreamField

This class describes the serializable field.

OutputStream

This class represents an output stream of bytes.

OutputStreamWriter

It writes bytes and decodes them into characters.

PipedInputStream

In this class the data bytes are written into piped output stream. This class also connected into a piped output stream.

PipedOutputStream

This class also communicates the piped input stream into piped output stream. It creates communication between both.

PipedReader

It is a piped character-input stream.

PipedWriter

It is a piped character-output stream.

PrintStream

This class adds the functionality of another output stream.

PrintWriter

This class adds the functionality of another input stream.

PushbackInputStream

It also include the another function of input stream. Such as: “push back” or “unread” one byte.

PushbackReader

This is a character stream reader and reads the data push back into the stream.

RandomAccessFile

It supports both reading and writing to a random access file.

Reader

It is used for reading character stream.

SequenceInputStream

It represents the logical concatenation of other input stream.

SerializablePermission

This is a serializable permission class.

StreamTokenizer

It takes an input stream and parses it into “tokens”. The token to be allowed at the read time.

StringReader

This is a character string class. It has character read source.

StringWriter

This is also a character string class. It uses to shows the output in the buffer.

Writer

It is used for writing to character stream.

 

Interfaces

The Interfaces provided by the java.io package shown in the table below:

Interface
Description

DataInput

This interface can be used for reading byte stream and reconstructing the java primitive data types.

DataOutput

This interface can be used for writing the byte stream and converting data from the java primitive data types.

Externalizable

This is written in Serializable Stream. It saves and stores its contents.

FileFilter

It can be used for Filtering the Pathnames.

FilenameFilter

This interface used for Filter the Filenames.

ObjectInput

This interface used for reading of objects and it extends the DataInput interface.

ObjectInputValidation

This is a Callback interface. It allows the validation of objects within a graph.

ObjectOutput

This interface used for writing of objects and it extends the DataOutput interface.

ObjectStreamConstants

This interface used for Constants writing into Serialization Objects Stream.

Serializable

This interface implementing in the java.io.Serializable interface.

 

Exceptions Classes:

The exception classes of the java.io package shown in the table below:

Exceptions
Description

CharConversionException

It provides detail message in the catch block to associated with the CharConversionException

EOFException

This exception indicates the end of file. When the file input stream to be end then EOFException to be occuted.

FileNotFoundException

When the open file’s pathname does not find then this exception to be occured.

InterruptedIOException

When the I/O operations to interrupt from any causes then it becomes.

InvalidClassException

Any problems to be created with class, when the Serializing runtime to be detected.

InvalidObjectException

When the de-serialized objects failed then it occurs.

IOException

When the I/O operations to be failed then it occurs.

NotActiveException

The Serialization or deserialization operations are not active then it occurs.

NotSerializableException

This exception when the instance is required to a Serializable interface.

ObjectStreamException

This is a supper class of all exception class. It is used for specific to Object Stream Classes.

OptionalDataException

When the reading data operations to fail then it these exception occurs. It is belonging to the serialized object

StreamCorruptedException

It thrown when the control information that was read form an object stream violates internal consistency checks.

SyncFaieldException

The sync operation is failed then SyncFaieldException to be occurred.

UnsupportedEncodingException

The Character Encoding is not supported.

UTFDataFormatException

A malformed UTF-8 has been read in a data input stream, it implemented by data input interface.

WriteAbortedException

In this exception to be thrown by the ObjectStreamException during a write operating.

 

 

In the next section we will describe about Java Standard Streams.