|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.nio.Buffer
java.nio.ShortBuffer
java.nio.ShortToByteBufferAdapter
final class ShortToByteBufferAdapter
This class wraps a byte buffer to be a short buffer.
Implementation notice:
| Field Summary |
|---|
| Fields inherited from class java.nio.Buffer |
|---|
_elementSizeShift, capacity, limit, mark, position, UNSET_MARK |
| Constructor Summary | |
|---|---|
ShortToByteBufferAdapter(ByteBuffer byteBuffer)
|
|
| Method Summary | |
|---|---|
void |
addressValidityCheck()
|
ShortBuffer |
asReadOnlyBuffer()
Returns a readonly buffer that shares content with this buffer. |
ShortBuffer |
compact()
Compacts this short buffer. |
ShortBuffer |
duplicate()
Returns a duplicated buffer that shares content with this buffer. |
void |
free()
|
short |
get()
Returns the short at the current position and increase the position by 1. |
short |
get(int index)
Returns a short at the specified index, and the position is not changed. |
org.apache.harmony.luni.platform.PlatformAddress |
getBaseAddress()
|
int |
getByteCapacity()
|
org.apache.harmony.luni.platform.PlatformAddress |
getEffectiveAddress()
|
boolean |
isAddressValid()
|
boolean |
isDirect()
Returns true if this buffer is direct. |
boolean |
isReadOnly()
Returns whether this buffer is readonly or not. |
ByteOrder |
order()
Returns the byte order used by this buffer when converting shorts from/to bytes. |
protected short[] |
protectedArray()
Child class implements this method to realize array(). |
protected int |
protectedArrayOffset()
Child class implements this method to realize arrayOffset(). |
protected boolean |
protectedHasArray()
Child class implements this method to realize hasArray(). |
ShortBuffer |
put(int index,
short c)
Write a short to the specified index of this buffer and the position is not changed. |
ShortBuffer |
put(short c)
Writes the given short to the current position and increase the position by 1. |
ShortBuffer |
put(short[] s,
int off,
int len)
Writes shorts in the given short array, starting from the
specified offset, to the current position and increase the position by
the number of shorts written. |
ShortBuffer |
slice()
Returns a sliced buffer that shares content with this buffer. |
(package private) static ShortBuffer |
wrap(ByteBuffer byteBuffer)
|
| Methods inherited from class java.nio.ShortBuffer |
|---|
_array, _arrayOffset, allocate, array, arrayOffset, compareTo, equals, get, get, hasArray, hashCode, put, put, toString, wrap, wrap |
| Methods inherited from class java.nio.Buffer |
|---|
capacity, clear, flip, hasRemaining, limit, limit, mark, position, position, remaining, reset, rewind |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
ShortToByteBufferAdapter(ByteBuffer byteBuffer)
| Method Detail |
|---|
static ShortBuffer wrap(ByteBuffer byteBuffer)
public int getByteCapacity()
getByteCapacity in interface org.apache.harmony.nio.internal.DirectBufferpublic org.apache.harmony.luni.platform.PlatformAddress getEffectiveAddress()
getEffectiveAddress in interface org.apache.harmony.nio.internal.DirectBufferpublic org.apache.harmony.luni.platform.PlatformAddress getBaseAddress()
getBaseAddress in interface org.apache.harmony.nio.internal.DirectBufferpublic boolean isAddressValid()
isAddressValid in interface org.apache.harmony.nio.internal.DirectBufferpublic void addressValidityCheck()
addressValidityCheck in interface org.apache.harmony.nio.internal.DirectBufferpublic void free()
free in interface org.apache.harmony.nio.internal.DirectBufferpublic ShortBuffer asReadOnlyBuffer()
ShortBufferThe returned buffer is guaranteed to be a new instance, even this buffer is readonly itself. The new buffer's position, limit, capacity and mark are the same as this buffer.
The new buffer shares content with this buffer, which means this buffer's change of content will be visible to the new buffer. The two buffer's position, limit and mark are independent.
asReadOnlyBuffer in class ShortBufferpublic ShortBuffer compact()
ShortBuffer
The remaining shorts will be moved to the head of the
buffer, staring from position zero. Then the position is set to
remaining(); the limit is set to capacity; the mark is
cleared.
compact in class ShortBufferpublic ShortBuffer duplicate()
ShortBufferThe duplicated buffer's position, limit, capacity and mark are the same as this buffer. The duplicated buffer's readonly property and byte order are same as this buffer too.
The new buffer shares content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.
duplicate in class ShortBufferpublic short get()
ShortBuffer
get in class ShortBufferpublic short get(int index)
ShortBuffer
get in class ShortBufferindex - The index, must be no less than zero and less than limit
public boolean isDirect()
ShortBufferA direct buffer will try its best to take advantage of native memory APIs and it may not stay in java heap, thus not affected by GC.
A short buffer is direct, if it is based on a byte buffer and the byte buffer is direct.
isDirect in class ShortBufferpublic boolean isReadOnly()
Buffer
isReadOnly in class Bufferpublic ByteOrder order()
ShortBuffershorts from/to bytes.
If this buffer is not based on a byte buffer, then always return the platform's native byte order.
order in class ShortBuffershorts from/to bytes.protected short[] protectedArray()
ShortBufferarray().
protectedArray in class ShortBufferarray()protected int protectedArrayOffset()
ShortBufferarrayOffset().
protectedArrayOffset in class ShortBufferarrayOffset()protected boolean protectedHasArray()
ShortBufferhasArray().
protectedHasArray in class ShortBufferhasArray()public ShortBuffer put(short c)
ShortBuffer
put in class ShortBufferc - The short to write
public ShortBuffer put(int index,
short c)
ShortBuffer
put in class ShortBufferindex - The index, must be no less than zero and less than the limitc - The short to write
public ShortBuffer put(short[] s,
int off,
int len)
ShortBuffershorts in the given short array, starting from the
specified offset, to the current position and increase the position by
the number of shorts written.
put in class ShortBuffers - The source short arrayoff - The offset of short array, must be no less than zero and no
greater than src.lengthlen - The number of shorts to write, must be no less
than zero and no greater than src.length - off
public ShortBuffer slice()
ShortBuffer
The sliced buffer's capacity will be this buffer's
remaining(), and its zero position will correspond to
this buffer's current position. The new buffer's position will be 0,
limit will be its capacity, and its mark is unset. The new buffer's
readonly property and byte order are same as this buffer.
The new buffer shares content with this buffer, which means either buffer's change of content will be visible to the other. The two buffer's position, limit and mark are independent.
slice in class ShortBuffer
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||