Top Description Interfaces Annotations Classes
module java.base

Package java.io


Provides for system input and output through data streams, serialization and the file system. Unless otherwise noted, passing a null argument to a constructor or method in any class or interface in this package will cause a NullPointerException to be thrown. A pathname string passed as a String argument to a constructor or method in any class or interface in this package will be interpreted as described in the class specification of File.

Object Serialization

Warning

Deserialization of untrusted data is inherently dangerous and should be avoided. Untrusted data should be carefully validated according to the "Serialization and Deserialization" section of the Secure Coding Guidelines for Java SE.

Since
1.0
External Specification
Java Object Serialization Specification

Interface Summary

Modifier and TypeInterface and Description
public interface
Closeable

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

public interface
DataInput

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

public interface
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.

public interface
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.

public interface
FileFilter

A filter for abstract pathnames.

public interface
FilenameFilter

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

public interface
Flushable

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

public interface
ObjectInput

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

public interface
ObjectInputFilter

Filter classes, array lengths, and graph metrics during deserialization.

public interface
ObjectInputValidation

Callback interface to allow validation of objects within a graph.

public interface
ObjectOutput

ObjectOutput extends the DataOutput interface to include writing of objects.

public interface
ObjectStreamConstants

Constants written into the Object Serialization Stream.

public interface
Serializable

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

Annotation Summary

Modifier and TypeAnnotation and Description
public @interface
Serial

Indicates that an annotated field or method is part of the serialization mechanism defined by the Java Object Serialization Specification.

Class Summary

Modifier and TypeClass and Description
public class
BufferedInputStream

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

public class
BufferedOutputStream

The class implements a buffered output stream.

public class
BufferedReader

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

public class
BufferedWriter

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

public class
ByteArrayInputStream

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

public class
ByteArrayOutputStream

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

public class
CharArrayReader

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

public class
CharArrayWriter

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

public class
CharConversionException

Base class for character conversion exceptions.

pack-priv abstract class
public class
Console

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

public class
DataInputStream

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

public class
DataOutputStream

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

pack-priv class
pack-priv class
DeleteOnExitHook

This class holds a set of filenames to be deleted on VM exit through a shutdown hook.

public class
EOFException

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

public class
File

An abstract representation of file and directory pathnames.

pack-priv class
FileCleanable

Cleanable for a FileDescriptor when it becomes phantom reachable.

public class
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.

public class
FileInputStream

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

public class
FileNotFoundException

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

public class
FileOutputStream

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

public class
FilePermission

This class represents access to a file or directory.

pack-priv class
FilePermissionCollection

A FilePermissionCollection stores a set of FilePermission permissions.

public class
FileReader

Reads text from character files using a default buffer size.

pack-priv abstract class
FileSystem

Package-private abstract class for the local filesystem abstraction.

public class
FileWriter

Writes text to character files using a default buffer size.

public class
FilterInputStream

A FilterInputStream wraps some other input stream, which it uses as its basic source of data, possibly transforming the data along the way or providing additional functionality.

public class
FilterOutputStream

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

public abstract class
FilterReader

Abstract class for reading filtered character streams.

public abstract class
FilterWriter

Abstract class for writing filtered character streams.

public abstract class
InputStream

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

public class
InputStreamReader

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

public class
InterruptedIOException

Signals that an I/O operation has been interrupted.

public class
InvalidClassException

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

public class
InvalidObjectException

Indicates that one or more deserialized objects failed validation tests.

public class
IOError

Thrown when a serious I/O error has occurred.

public class
IOException

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

public class
LineNumberInputStream

Deprecated This class incorrectly assumes that bytes adequately represent characters.
This class is an input stream filter that provides the added functionality of keeping track of the current line number.
public class
LineNumberReader

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

public class
NotActiveException

Thrown when serialization or deserialization is not active.

public class
NotSerializableException

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

public class
ObjectInputStream

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

public class
ObjectOutputStream

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

public class
ObjectStreamClass

Serialization's descriptor for classes.

public abstract class
ObjectStreamException

Superclass of all exceptions specific to Object Stream classes.

public class
ObjectStreamField

A description of a Serializable field from a Serializable class.

public class
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.

public abstract class
OutputStream

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

public class
OutputStreamWriter

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

public class
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.

public class
PipedOutputStream

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

public class
PipedReader

Piped character-input streams.

public class
PipedWriter

Piped character-output streams.

public class
PrintStream

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

public class
PrintWriter

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

pack-priv class
ProxyingConsole

Console implementation for internal use.

public class
PushbackInputStream

A PushbackInputStream adds functionality to another input stream, namely the ability to "push back" or "unread" bytes, by storing pushed-back bytes in an internal buffer.

public class
PushbackReader

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

public class
RandomAccessFile

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

public abstract class
Reader

Abstract class for reading character streams.

public class
SequenceInputStream

A SequenceInputStream represents the logical concatenation of other input streams.

pack-priv class
SerialCallbackContext

Context during upcalls from object stream to class-defined readObject/writeObject methods.

public class
SerializablePermission

This class is for Serializable permissions.

public class
StreamCorruptedException

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

public class
StreamTokenizer

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

public class
StringBufferInputStream

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.
This class allows an application to create an input stream in which the bytes read are supplied by the contents of a string.
public class
StringReader

A character stream whose source is a string.

public class
StringWriter

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

public class
SyncFailedException

Signals that a sync operation has failed.

public class
UncheckedIOException

Wraps an IOException with an unchecked exception.

pack-priv class
public class
UnsupportedEncodingException

The Character Encoding is not supported.

public class
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.

public class
WriteAbortedException

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

public abstract class
Writer

Abstract class for writing to character streams.