ShortBuffer

public abstract class ShortBuffer extends Buffer
implements Comparable<ShortBuffer>

A short buffer.

This class defines four categories of operations upon short buffers:

  • Absolute and relative get and put methods that read and write single shorts;

  • Relative bulk get methods that transfer contiguous sequences of shorts from this buffer into an array; and

  • Relative bulk put methods that transfer contiguous sequences of shorts from a short array or some other short buffer into this buffer; and

  • Methods for compacting, duplicating, and slicing a short buffer.

Short buffers can be created either by allocation, which allocates space for the buffer's content, by wrapping an existing short array into a buffer, or by creating a view of an existing byte buffer.

Like a byte buffer, a short buffer is either direct or non-direct. A short buffer created via the wrap methods of this class will be non-direct. A short buffer created as a view of a byte buffer will be direct if, and only if, the byte buffer itself is direct. Whether or not a short buffer is direct may be determined by invoking the isDirect method.

Methods in this class that do not otherwise have a value to return are specified to return the buffer upon which they are invoked. This allows method invocations to be chained.

Public Method Summary

static ShortBuffer
allocate(int capacity)
Allocates a new short buffer.
final short[]
array()
Returns the short array that backs this buffer  (optional operation).
final int
arrayOffset()
Returns the offset within this buffer's backing array of the first element of the buffer  (optional operation).
abstract ShortBuffer
asReadOnlyBuffer()
Creates a new, read-only short buffer that shares this buffer's content.
abstract ShortBuffer
compact()
Compacts this buffer  (optional operation).
int
compareTo(ShortBuffer that)
Compares this buffer to another.
abstract ShortBuffer
duplicate()
Creates a new short buffer that shares this buffer's content.
boolean
equals(Object ob)
Tells whether or not this buffer is equal to another object.
abstract short
get()
Relative get method.
ShortBuffer
get(short[] dst, int offset, int length)
Relative bulk get method.
ShortBuffer
get(short[] dst)
Relative bulk get method.
abstract short
get(int index)
Absolute get method.
final boolean
hasArray()
Tells whether or not this buffer is backed by an accessible short array.
int
hashCode()
Returns the current hash code of this buffer.
abstract boolean
isDirect()
Tells whether or not this short buffer is direct.
abstract ByteOrder
order()
Retrieves this buffer's byte order.
ShortBuffer
put(short[] src, int offset, int length)
Relative bulk put method  (optional operation).
final ShortBuffer
put(short[] src)
Relative bulk put method  (optional operation).
abstract ShortBuffer
put(short s)
Relative put method  (optional operation).
abstract ShortBuffer
put(int index, short s)
Absolute put method  (optional operation).
ShortBuffer
put(ShortBuffer src)
Relative bulk put method  (optional operation).
abstract ShortBuffer
slice()
Creates a new short buffer whose content is a shared subsequence of this buffer's content.
String
toString()
Returns a string summarizing the state of this buffer.
static ShortBuffer
wrap(short[] array, int offset, int length)
Wraps a short array into a buffer.
static ShortBuffer
wrap(short[] array)
Wraps a short array into a buffer.

Inherited Method Summary