java.io Package

java.io Package : Provides for system input and output through data streams, serialization and the file system.

Interfaces in java.io Package

S.No Interface & Description
1 Closeable

A Closeable is a source or destination of data that can be closed.
2 DataInput

The DataInput interface provides for reading bytes from a binary stream and reconstructing from them data in any of the Java primitive types.
3 DataOutput

The DataOutput interface provides for converting data from any of the Java primitive types to a series of bytes and writing these bytes to a binary stream.
4 Externalizable

Only the identity of the class of an Externalizable instance is written in the serialization stream and it is the responsibility of the class to save and restore the contents of its instances.
5 FileFilter

A filter for abstract pathnames.
6 FilenameFilter

Instances of classes that implement this interface are used to filter filenames.
7 Flushable

A Flushable is a destination of data that can be flushed.
8 ObjectInput

ObjectInput extends the DataInput interface to include the reading of objects.
9 ObjectInputValidation

Callback interface to allow validation of objects within a graph.
10 ObjectOutput

ObjectOutput extends the DataOutput interface to include writing of objects.
11 ObjectStreamConstants

Constants written into the Object Serialization Stream.
12 Serializable

Serializability of a class is enabled by the class implementing the java.io.Serializable interface.

Classes in java.io Package

S.No Class & Description
1 BufferedInputStream

A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the mark and reset methods.
2 BufferedOutputStream

The class implements a buffered output stream.
3 BufferedReader

Reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.
4 BufferedWriter

Writes text to a character-output stream, buffering characters so as to provide for the efficient writing of single characters, arrays, and strings.
5 ByteArrayInputStream

A ByteArrayInputStream contains an internal buffer that contains bytes that may be read from the stream.
6 ByteArrayOutputStream

This class implements an output stream in which the data is written into a byte array.
7 CharArrayReader

This class implements a character buffer that can be used as a character-input stream.
8 CharArrayWriter

This class implements a character buffer that can be used as an Writer.
9 Console

Methods to access the character-based console device, if any, associated with the current Java virtual machine.
10 DataInputStream

A data input stream lets an application read primitive Java data types from an underlying input stream in a machine-independent way.
11 DataOutputStream

A data output stream lets an application write primitive Java data types to an output stream in a portable way.
12 File

An abstract representation of file and directory pathnames.
13 FileDescriptor

Instances of the file descriptor class serve as an opaque handle to the underlying machine-specific structure representing an open file, an open socket, or another source or sink of bytes.
14 FileInputStream

A FileInputStream obtains input bytes from a file in a file system.
15 FileOutputStream

A file output stream is an output stream for writing data to a File or to a FileDescriptor.
16 FilePermission

This class represents access to a file or directory.
17 FileReader

Convenience class for reading character files.
18 FileWriter

Convenience class for writing character files.
19 FilterInputStream

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.
20 FilterOutputStream

This class is the superclass of all classes that filter output streams.
21 FilterReader

Abstract class for reading filtered character streams.
22 FilterWriter

Abstract class for writing filtered character streams.
23 InputStream

This abstract class is the superclass of all classes representing an input stream of bytes.
24 InputStreamReader

An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset.
25 LineNumberInputStream

This class incorrectly assumes that bytes adequately represent characters.
26 LineNumberReader

A buffered character-input stream that keeps track of line numbers.
27 ObjectInputStream

An ObjectInputStream deserializes primitive data and objects previously written using an ObjectOutputStream.
28 ObjectInputStream.GetField

Provide access to the persistent fields read from the input stream.
29 ObjectOutputStream

An ObjectOutputStream writes primitive data types and graphs of Java objects to an OutputStream.
30 ObjectOutputStream.PutField

Provide programmatic access to the persistent fields to be written to ObjectOutput.
31 ObjectStreamClass

Serialization’s descriptor for classes.
32 ObjectStreamField

A description of a Serializable field from a Serializable class.
33 OutputStream

This abstract class is the superclass of all classes representing an output stream of bytes.
34 OutputStreamWriter

An OutputStreamWriter is a bridge from character streams to byte streams: Characters written to it are encoded into bytes using a specified charset.
35 PipedInputStream

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.
36 PipedOutputStream

A piped output stream can be connected to a piped input stream to create a communications pipe.
37 PipedReader

Piped character-input streams.
38 PipedWriter

Piped character-output streams.
39 PrintStream

A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently.
40 PrintWriter

Prints formatted representations of objects to a text-output stream.
41 PushbackInputStream

A PushbackInputStream adds functionality to another input stream, namely the ability to "push back" or "unread" one byte.
42 PushbackReader

A character-stream reader that allows characters to be pushed back into the stream.
43 RandomAccessFile

Instances of this class support both reading and writing to a random access file.
44 Reader

Abstract class for reading character streams.
45 SequenceInputStream

A SequenceInputStream represents the logical concatenation of other input streams.
46 SerializablePermission

This class is for Serializable permissions.
47 StreamTokenizer

The StreamTokenizer class takes an input stream and parses it into "tokens", allowing the tokens to be read one at a time.
48 StringBufferInputStream

This class does not properly convert characters into bytes.
49 StringReader

A character stream whose source is a string.
50 StringWriter

A character stream that collects its output in a string buffer, which can then be used to construct a string.
51 Writer

Abstract class for writing to character streams.

Exception Classes in java.io Package

S.No Exception Class & Description
1 CharConversionException

Base class for character conversion exceptions.
2 EOFException

Signals that an end of file or end of stream has been reached unexpectedly during input.
3 FileNotFoundException

Signals that an attempt to open the file denoted by a specified pathname has failed.
4 InterruptedIOException

Signals that an I/O operation has been interrupted.
5 InvalidClassException

Thrown when the Serialization runtime detects one of the following problems with a Class.
6 InvalidObjectException

Indicates that one or more deserialized objects failed validation tests.
7 IOException

Signals that an I/O exception of some sort has occurred.
8 NotActiveException

Thrown when serialization or deserialization is not active.
9 NotSerializableException

Thrown when an instance is required to have a Serializable interface.
10 ObjectStreamException

Superclass of all exceptions specific to Object Stream classes.
11 OptionalDataException

Exception indicating the failure of an object read operation due to unread primitive data, or the end of data belonging to a serialized object in the stream.
12 StreamCorruptedException

Thrown when control information that was read from an object stream violates internal consistency checks.
13 SyncFailedException

Signals that a sync operation has failed.
14 UncheckedIOException

Wraps an IOException with an unchecked exception.
15 UnsupportedEncodingException

The Character Encoding is not supported.
16 UTFDataFormatException

Signals that a malformed string in modified UTF-8 format has been read in a data input stream or by any class that implements the data input interface.
17 WriteAbortedException

Signals that one of the ObjectStreamExceptions was thrown during a write operation.

Error Classes in java.io Package

S.No Error Class & Description
1 IOError

Thrown when a serious I/O error has occurred.

Ask your questions in eHowToNow Forum

Post your technical, non-technical doubts, questions in our site. Get answer as soon as possible, meanwhile you can help others by answering, unanswered questions.
To Ask new Question : Ask Question
Check our existing discussions : Questions & Answers

  1. Java BufferedInputStream reset() method with example
  2. Java BufferedOutputStream flush() method with example
  3. Java – ObjectOutput Interface
  4. Java – PushbackReader Class
  5. How to retrieve drive/root directories from system using Java
  6. Java BufferedInputStream close() method with example
  7. Java – PipedInputStream Class
  8. Java – CharArrayWriter Class
  9. How to create temp file using Java
  10. Java BufferedOutputStream write(int b) method with example
  11. Java – FileOutputStream Class
  12. Java – PipedWriter Class
  13. Java – FileDescriptor Class
  14. Java – DataOutput Interface
  15. Java – ObjectStreamField Class

Be the first to comment

Leave a Reply