java.nio.channels | Defines channels, which represent connections to entities that are capable of performing I/O operations, such as files and sockets; defines selectors, for multiplexed, non-blocking I/O operations. |
java.nio.channels.spi | Service-provider classes for the java.nio.channels package. |
java.nio.charset | Defines charsets, decoders, and encoders, for translating between bytes and Unicode characters. |
java.nio.charset.spi | Service-provider classes for the java.nio.charset package. |
java.nio.file | |
java.nio.file.attribute | |
java.nio.file.spi |
BaseByteBuffer | Serves as the root of other byte buffer impl classes, implements common methods that can be shared by child classes. | code | html |
Buffer | A container for data of a specific primitive type. | code | html |
ByteBuffer | A buffer for bytes. | code | html |
CharArrayBuffer | CharArrayBuffer, ReadWriteCharArrayBuffer and ReadOnlyCharArrayBuffer compose the implementation of array based char buffers. | code | html |
CharBuffer | A buffer of chars. | code | html |
DirectByteBuffer | DirectByteBuffer, ReadWriteDirectByteBuffer and ReadOnlyDirectByteBuffer compose the implementation of platform memory based byte buffers. | code | html |
DirectByteBufferImpl | code | html | |
DoubleArrayBuffer | DoubleArrayBuffer, ReadWriteDoubleArrayBuffer and ReadOnlyDoubleArrayBuffer compose the implementation of array based double buffers. | code | html |
DoubleBuffer | A buffer of doubles. | code | html |
FloatArrayBuffer | FloatArrayBuffer, ReadWriteFloatArrayBuffer and ReadOnlyFloatArrayBuffer compose the implementation of array based float buffers. | code | html |
FloatBuffer | A buffer of floats. | code | html |
HeapByteBuffer | HeapByteBuffer, ReadWriteHeapByteBuffer and ReadOnlyHeapByteBuffer compose the implementation of array based byte buffers. | code | html |
IntArrayBuffer | IntArrayBuffer, ReadWriteIntArrayBuffer and ReadOnlyIntArrayBuffer compose the implementation of array based int buffers. | code | html |
IntBuffer | A buffer of ints. | code | html |
LongArrayBuffer | LongArrayBuffer, ReadWriteLongArrayBuffer and ReadOnlyLongArrayBuffer compose the implementation of array based long buffers. | code | html |
LongBuffer | A buffer of longs. | code | html |
MappedByteBuffer | A direct byte buffer whose content is a memory-mapped region of a file. | code | html |
ShortArrayBuffer | ShortArrayBuffer, ReadWriteShortArrayBuffer and ReadOnlyShortArrayBuffer compose the implementation of array based short buffers. | code | html |
ShortBuffer | A buffer of shorts. | code | html |
Bits | Access to bits, native and otherwise. | code | html |
BufferFactory | Provide factory service of buffer classes. | code | html |
BufferOverflowException | A BufferOverflowException is thrown when elements are written
to a buffer but there is not enough remaining space in the buffer. |
code | html |
BufferUnderflowException | A BufferUnderflowException is thrown when elements are read
from a buffer but there are not enough remaining elements in the buffer. |
code | html |
ByteBufferHelper | code | html | |
ByteBufferImpl | This is a Heap memory implementation | code | html |
ByteOrder | A typesafe enumeration for byte orders. | code | html |
CharBufferImpl | This is a Heap memory implementation | code | html |
CharSequenceAdapter | This class wraps a char sequence to be a char buffer. | code | html |
CharToByteBufferAdapter | This class wraps a byte buffer to be a char buffer. | code | html |
CharViewBufferImpl | code | html | |
DirectByteBufferImpl.ReadOnly | code | html | |
DirectByteBufferImpl.ReadWrite | code | html | |
DoubleBufferImpl | This is a Heap memory implementation | code | html |
DoubleToByteBufferAdapter | This class wraps a byte buffer to be a double buffer. | code | html |
DoubleViewBufferImpl | code | html | |
FloatBufferImpl | This is a Heap memory implementation | code | html |
FloatToByteBufferAdapter | This class wraps a byte buffer to be a float buffer. | code | html |
FloatViewBufferImpl | code | html | |
IntBufferImpl | This is a Heap memory implementation | code | html |
IntToByteBufferAdapter | This class wraps a byte buffer to be a int buffer. | code | html |
IntViewBufferImpl | code | html | |
InvalidMarkException | An {@code InvalidMarkException} is thrown when {@code reset()} is called on a buffer, but no mark has been set previously. | code | html |
LongBufferImpl | This is a Heap memory implementation | code | html |
LongToByteBufferAdapter | This class wraps a byte buffer to be a long buffer. | code | html |
LongViewBufferImpl | code | html | |
MappedByteBufferAdapter | code | html | |
MappedByteBufferImpl | code | html | |
ReadOnlyBufferException | A {@code ReadOnlyBufferException} is thrown when some write operation is called on a read-only buffer. | code | html |
ReadOnlyCharArrayBuffer | CharArrayBuffer, ReadWriteCharArrayBuffer and ReadOnlyCharArrayBuffer compose the implementation of array based char buffers. | code | html |
ReadOnlyDirectByteBuffer | DirectByteBuffer, ReadWriteDirectByteBuffer and ReadOnlyDirectByteBuffer compose the implementation of platform memory based byte buffers. | code | html |
ReadOnlyDoubleArrayBuffer | DoubleArrayBuffer, ReadWriteDoubleArrayBuffer and ReadOnlyDoubleArrayBuffer compose the implementation of array based double buffers. | code | html |
ReadOnlyFloatArrayBuffer | FloatArrayBuffer, ReadWriteFloatArrayBuffer and ReadOnlyFloatArrayBuffer compose the implementation of array based float buffers. | code | html |
ReadOnlyHeapByteBuffer | HeapByteBuffer, ReadWriteHeapByteBuffer and ReadOnlyHeapByteBuffer compose the implementation of array based byte buffers. | code | html |
ReadOnlyIntArrayBuffer | IntArrayBuffer, ReadWriteIntArrayBuffer and ReadOnlyIntArrayBuffer compose the implementation of array based int buffers. | code | html |
ReadOnlyLongArrayBuffer | LongArrayBuffer, ReadWriteLongArrayBuffer and ReadOnlyLongArrayBuffer compose the implementation of array based long buffers. | code | html |
ReadOnlyShortArrayBuffer | ShortArrayBuffer, ReadWriteShortArrayBuffer and ReadOnlyShortArrayBuffer compose the implementation of array based short buffers. | code | html |
ReadWriteCharArrayBuffer | CharArrayBuffer, ReadWriteCharArrayBuffer and ReadOnlyCharArrayBuffer compose the implementation of array based char buffers. | code | html |
ReadWriteDirectByteBuffer | DirectByteBuffer, ReadWriteDirectByteBuffer and ReadOnlyDirectByteBuffer compose the implementation of platform memory based byte buffers. | code | html |
ReadWriteDoubleArrayBuffer | DoubleArrayBuffer, ReadWriteDoubleArrayBuffer and ReadOnlyDoubleArrayBuffer compose the implementation of array based double buffers. | code | html |
ReadWriteFloatArrayBuffer | FloatArrayBuffer, ReadWriteFloatArrayBuffer and ReadOnlyFloatArrayBuffer compose the implementation of array based float buffers. | code | html |
ReadWriteHeapByteBuffer | HeapByteBuffer, ReadWriteHeapByteBuffer and ReadOnlyHeapByteBuffer compose the implementation of array based byte buffers. | code | html |
ReadWriteIntArrayBuffer | IntArrayBuffer, ReadWriteIntArrayBuffer and ReadOnlyIntArrayBuffer compose the implementation of array based int buffers. | code | html |
ReadWriteLongArrayBuffer | LongArrayBuffer, ReadWriteLongArrayBuffer and ReadOnlyLongArrayBuffer compose the implementation of array based long buffers. | code | html |
ReadWriteShortArrayBuffer | ShortArrayBuffer, ReadWriteShortArrayBuffer and ReadOnlyShortArrayBuffer compose the implementation of array based short buffers. | code | html |
ShortBufferImpl | This is a Heap memory implementation | code | html |
ShortToByteBufferAdapter | This class wraps a byte buffer to be a short buffer. | code | html |
ShortViewBufferImpl | code | html | |
StringCharBuffer | code | html | |
VMDirectByteBuffer | code | html |
The central abstractions of the NIO APIs are:
Buffers, which are containers for data;
Charsets and their
associated decoders and encoders,
which translate between
bytes and Unicode characters;
Channels of
various types, which represent connections
to entities capable of
performing I/O operations; and
Selectors and selection keys, which together with
selectable channels define a multiplexed, non-blocking
I/O facility.
The java.nio package defines the buffer classes, which are used
throughout the NIO APIs. The charset API is defined in the java.nio.charset package, and the channel and selector APIs are defined in the
java.nio.channels package. Each of these subpackages has its own
service-provider (SPI) subpackage, the contents of which can be used to extend
the platform's default implementations or to construct alternative
implementations.
Buffers Description A buffer is a container for a fixed amount of data of a specific
primitive type. In addition to its content a buffer has a position,
which is the index of the next element to be read or written, and a
limit, which is the index of the first element that should not be read
or written. The base java.nio.Buffer class defines these properties as
well as methods for clearing, flipping, and rewinding, for
marking the current position, and for resetting the position to
the previous mark.
There is a buffer class for each non-boolean primitive type. Each class
defines a family of get and put methods for moving data out of
and in to a buffer, methods for compacting, duplicating, and
slicing a buffer, and static methods for allocating a new buffer
as well as for wrapping an existing array into a buffer.
Byte buffers are distinguished in that they can be used as the sources and
targets of I/O operations. They also support several features not found in the
other buffer classes:
A byte buffer can be allocated as a
direct buffer, in which case the Java virtual machine will make a
best effort to perform native I/O operations directly upon it. A byte buffer can be created by mapping A byte buffer provides access to its content as either a heterogeneous
or homogeneous sequence of binary data
of any non-boolean primitive type, in either big-endian or little-endian byte order. 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.
@since 1.4
@author Mark Reinhold
@author JSR-51 Expert Group
java.nio.Buffer
Position, limit, and capacity;
clear, flip, rewind, and mark/reset java.nio.ByteBuffer
Get/put, compact, views; allocate, wrap java.nio.MappedByteBuffer
A byte buffer mapped to a file java.nio.CharBuffer
Get/put, compact; allocate, wrap java.nio.DoubleBuffer
' ' java.nio.FloatBuffer
' ' java.nio.IntBuffer
' ' java.nio.LongBuffer
' ' java.nio.ShortBuffer
' ' java.nio.ByteOrder
Typesafe enumeration for byte orders
a region of a
file directly into memory, in which case a few additional file-related
operations defined in the java.nio.MappedByteBuffer class are
available.