CLDC 8 (JSR360 Final Release)

Package java.nio

Defines buffers, which are containers for data.

See: Description

Package java.nio Description

Defines buffers, which are containers for data.

The NIO Buffer API subset consists of portions of the Buffer, ByteBuffer, ShortBuffer, IntBuffer, and FloatBuffer classes as well as the support classes BufferOverflowException, and BufferUnderflowException.

Only basic buffer functionality is supported, and does not include mapped buffers, charsets, or selectors, read-only buffers, mark, reset, and rewind. Primitive data types are supported only for byte, short, int, and float. No support is provided for data types char, long, or double.

The central abstractions of the NIO APIs are:

The java.nio package defines the buffer classes, which are used throughout the NIO APIs.

BuffersDescription
  Buffer Position, limit, and capacity;
clear, and flip
  ByteBuffer Get/put, views; allocate, wrap
  FloatBuffer Get/put, views; wrap
  IntBuffer Get/put, views; wrap
  ShortBuffer Get/put, views; wrap

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 Buffer class defines these properties as well as methods for clearing, flipping, and rewinding.

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 slicing a buffer, and static methods for wrapping an existing array into a buffer.

Byte buffers support several features not found in the other buffer classes:

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.

Note: Unlike their Java SE8 counterparts, the CLDC8 versions of ByteBuffer, ShortBuffer, IntBuffer and FloatBuffer are not abstract but are concrete classes.

Since:
CLDC1.8
CLDC 8 (JSR360 Final Release)
April 15, 2014

Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. Use of this specification is subject to license terms.