|
|||||||||
| Home >> All >> java >> [ nio overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.nio
Class DirectByteBufferImpl

java.lang.Objectjava.nio.Buffer
java.nio.ByteBuffer
java.nio.DirectByteBufferImpl
- All Implemented Interfaces:
- java.lang.Comparable
- Direct Known Subclasses:
- DirectByteBufferImpl.ReadOnly, DirectByteBufferImpl.ReadWrite
- abstract class DirectByteBufferImpl
- extends ByteBuffer
| Nested Class Summary | |
(package private) static class |
DirectByteBufferImpl.ReadOnly
|
(package private) static class |
DirectByteBufferImpl.ReadWrite
|
| Field Summary | |
private java.lang.Object |
owner
The owner is used to keep alive the object that actually owns the memory. |
| Fields inherited from class java.nio.ByteBuffer |
array_offset, backing_buffer, endian |
| Fields inherited from class java.nio.Buffer |
address, cap, limit, mark, pos |
| Constructor Summary | |
(package private) |
DirectByteBufferImpl(int capacity)
|
(package private) |
DirectByteBufferImpl(java.lang.Object owner,
gnu.classpath.Pointer address,
int capacity,
int limit,
int position)
|
| Method Summary | |
static ByteBuffer |
allocate(int capacity)
Allocates a new direct byte buffer. |
CharBuffer |
asCharBuffer()
Creates a view of this byte buffer as a char buffer. |
DoubleBuffer |
asDoubleBuffer()
Creates a view of this byte buffer as a double buffer. |
FloatBuffer |
asFloatBuffer()
Creates a view of this byte buffer as a float buffer. |
IntBuffer |
asIntBuffer()
Creates a view of this byte buffer as an integer buffer. |
LongBuffer |
asLongBuffer()
Creates a view of this byte buffer as a long buffer. |
ByteBuffer |
asReadOnlyBuffer()
Creates a new read-only ByteBuffer that shares this
buffer's content. |
ShortBuffer |
asShortBuffer()
Creates a view of this byte buffer as a short buffer. |
ByteBuffer |
compact()
Compacts this buffer. |
ByteBuffer |
duplicate()
Creates a new ByteBuffer that shares this buffer's
content. |
private ByteBuffer |
duplicate(boolean readOnly)
|
protected void |
finalize()
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. |
byte |
get()
Reads the byte at this buffer's current position,
and then increments the position. |
ByteBuffer |
get(byte[] dst,
int offset,
int length)
This method transfers bytes from this buffer into the given
destination array. |
byte |
get(int index)
Absolute get method. |
char |
getChar()
Relative get method for reading a character value. |
char |
getChar(int index)
Absolute get method for reading a character value. |
double |
getDouble()
Relative get method for reading a double value. |
double |
getDouble(int index)
Absolute get method for reading a double value. |
float |
getFloat()
Relative get method for reading a float value. |
float |
getFloat(int index)
Absolute get method for reading a float value. |
int |
getInt()
Relative get method for reading an integer value. |
int |
getInt(int index)
Absolute get method for reading an integer value. |
long |
getLong()
Relative get method for reading a long value. |
long |
getLong(int index)
Absolute get method for reading a long value. |
short |
getShort()
Relative get method for reading a short value. |
short |
getShort(int index)
Absolute get method for reading a short value. |
boolean |
isDirect()
Tells whether or not this buffer is direct. |
ByteBuffer |
put(byte value)
Writes the byte at this buffer's current position,
and then increments the position. |
ByteBuffer |
put(byte[] src,
int offset,
int length)
Writes the content of the the byte array src
into the buffer. |
ByteBuffer |
put(int index,
byte value)
Absolute put method. |
ByteBuffer |
putChar(char value)
Relative put method for writing a character value. |
ByteBuffer |
putChar(int index,
char value)
Absolute put method for writing a character value. |
ByteBuffer |
putDouble(double value)
Relative put method for writing a double value. |
ByteBuffer |
putDouble(int index,
double value)
Absolute put method for writing a double value. |
ByteBuffer |
putFloat(float value)
Relative put method for writing a float value. |
ByteBuffer |
putFloat(int index,
float value)
Relative put method for writing a float value. |
ByteBuffer |
putInt(int value)
Relative put method for writing an integer value. |
ByteBuffer |
putInt(int index,
int value)
Absolute put method for writing an integer value. |
ByteBuffer |
putLong(int index,
long value)
Absolute put method for writing a float value. |
ByteBuffer |
putLong(long value)
Relative put method for writing a long value. |
ByteBuffer |
putShort(int index,
short value)
Absolute put method for writing a short value. |
ByteBuffer |
putShort(short value)
Relative put method for writing a short value. |
(package private) void |
shiftDown(int dst_offset,
int src_offset,
int count)
|
ByteBuffer |
slice()
Creates a new ByteBuffer whose content is a shared
subsequence of this buffer's content. |
| Methods inherited from class java.nio.ByteBuffer |
allocateDirect, array, arrayOffset, compareTo, equals, get, hasArray, hashCode, order, order, put, put, toString, wrap, wrap |
| Methods inherited from class java.nio.Buffer |
capacity, checkArraySize, checkForOverflow, checkForOverflow, checkForUnderflow, checkForUnderflow, checkIfReadOnly, checkIndex, clear, flip, hasRemaining, isReadOnly, limit, limit, mark, position, position, remaining, reset, rewind |
| Methods inherited from class java.lang.Object |
clone, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
owner
private final java.lang.Object owner
- The owner is used to keep alive the object that actually owns the
memory. There are three possibilities:
1) owner == this: We allocated the memory and we should free it,
but *only* in finalize (if we've been sliced
other objects will also have access to the
memory).
2) owner == null: The byte buffer was created thru
JNI.NewDirectByteBuffer. The JNI code is
responsible for freeing the memory.
3) owner == some other object: The other object allocated the
memory and should free it.
| Constructor Detail |
DirectByteBufferImpl
DirectByteBufferImpl(int capacity)
DirectByteBufferImpl
DirectByteBufferImpl(java.lang.Object owner, gnu.classpath.Pointer address, int capacity, int limit, int position)
| Method Detail |
allocate
public static ByteBuffer allocate(int capacity)
- Allocates a new direct byte buffer.
finalize
protected void finalize()
throws java.lang.Throwable
- Description copied from class:
java.lang.Object - Called on an object by the Virtual Machine at most once,
at some point after the Object is determined unreachable
but before it is destroyed. You would think that this
means it eventually is called on every Object, but this is
not necessarily the case. If execution terminates
abnormally, garbage collection does not always happen.
Thus you cannot rely on this method to always work.
For finer control over garbage collection, use references
from the
java.lang.refpackage.Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply
super.finalize().finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.
If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.
It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.
Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls
super.finalize().The default implementation does nothing.
get
public byte get()
- Description copied from class:
ByteBuffer - Reads the
byteat this buffer's current position, and then increments the position.- Specified by:
getin classByteBuffer
get
public byte get(int index)
- Description copied from class:
ByteBuffer - Absolute get method.
- Specified by:
getin classByteBuffer
get
public ByteBuffer get(byte[] dst, int offset, int length)
- Description copied from class:
ByteBuffer - This method transfers
bytes from this buffer into the given destination array. Before the transfer, it checks if there are fewer than lengthbytes remaining in this buffer.- Overrides:
getin classByteBuffer
put
public ByteBuffer put(byte value)
- Description copied from class:
ByteBuffer - Writes the
byteat this buffer's current position, and then increments the position.- Specified by:
putin classByteBuffer
put
public ByteBuffer put(int index, byte value)
- Description copied from class:
ByteBuffer - Absolute put method.
- Specified by:
putin classByteBuffer
put
public ByteBuffer put(byte[] src, int offset, int length)
- Description copied from class:
ByteBuffer - Writes the content of the the
byte arraysrc into the buffer. Before the transfer, it checks if there is fewer than length space remaining in this buffer.- Overrides:
putin classByteBuffer
shiftDown
void shiftDown(int dst_offset,
int src_offset,
int count)
- Overrides:
shiftDownin classByteBuffer
compact
public ByteBuffer compact()
- Description copied from class:
ByteBuffer - Compacts this buffer.
- Specified by:
compactin classByteBuffer
slice
public ByteBuffer slice()
- Description copied from class:
ByteBuffer - Creates a new
ByteBufferwhose content is a shared subsequence of this buffer's content.- Specified by:
slicein classByteBuffer
duplicate
private ByteBuffer duplicate(boolean readOnly)
duplicate
public ByteBuffer duplicate()
- Description copied from class:
ByteBuffer - Creates a new
ByteBufferthat shares this buffer's content.- Specified by:
duplicatein classByteBuffer
asReadOnlyBuffer
public ByteBuffer asReadOnlyBuffer()
- Description copied from class:
ByteBuffer - Creates a new read-only
ByteBufferthat shares this buffer's content.- Specified by:
asReadOnlyBufferin classByteBuffer
isDirect
public boolean isDirect()
- Description copied from class:
ByteBuffer - Tells whether or not this buffer is direct.
- Specified by:
isDirectin classByteBuffer
asCharBuffer
public CharBuffer asCharBuffer()
- Description copied from class:
ByteBuffer - Creates a view of this byte buffer as a char buffer.
- Specified by:
asCharBufferin classByteBuffer
asShortBuffer
public ShortBuffer asShortBuffer()
- Description copied from class:
ByteBuffer - Creates a view of this byte buffer as a short buffer.
- Specified by:
asShortBufferin classByteBuffer
asIntBuffer
public IntBuffer asIntBuffer()
- Description copied from class:
ByteBuffer - Creates a view of this byte buffer as an integer buffer.
- Specified by:
asIntBufferin classByteBuffer
asLongBuffer
public LongBuffer asLongBuffer()
- Description copied from class:
ByteBuffer - Creates a view of this byte buffer as a long buffer.
- Specified by:
asLongBufferin classByteBuffer
asFloatBuffer
public FloatBuffer asFloatBuffer()
- Description copied from class:
ByteBuffer - Creates a view of this byte buffer as a float buffer.
- Specified by:
asFloatBufferin classByteBuffer
asDoubleBuffer
public DoubleBuffer asDoubleBuffer()
- Description copied from class:
ByteBuffer - Creates a view of this byte buffer as a double buffer.
- Specified by:
asDoubleBufferin classByteBuffer
getChar
public char getChar()
- Description copied from class:
ByteBuffer - Relative get method for reading a character value.
- Specified by:
getCharin classByteBuffer
putChar
public ByteBuffer putChar(char value)
- Description copied from class:
ByteBuffer - Relative put method for writing a character value.
- Specified by:
putCharin classByteBuffer
getChar
public char getChar(int index)
- Description copied from class:
ByteBuffer - Absolute get method for reading a character value.
- Specified by:
getCharin classByteBuffer
putChar
public ByteBuffer putChar(int index, char value)
- Description copied from class:
ByteBuffer - Absolute put method for writing a character value.
- Specified by:
putCharin classByteBuffer
getShort
public short getShort()
- Description copied from class:
ByteBuffer - Relative get method for reading a short value.
- Specified by:
getShortin classByteBuffer
putShort
public ByteBuffer putShort(short value)
- Description copied from class:
ByteBuffer - Relative put method for writing a short value.
- Specified by:
putShortin classByteBuffer
getShort
public short getShort(int index)
- Description copied from class:
ByteBuffer - Absolute get method for reading a short value.
- Specified by:
getShortin classByteBuffer
putShort
public ByteBuffer putShort(int index, short value)
- Description copied from class:
ByteBuffer - Absolute put method for writing a short value.
- Specified by:
putShortin classByteBuffer
getInt
public int getInt()
- Description copied from class:
ByteBuffer - Relative get method for reading an integer value.
- Specified by:
getIntin classByteBuffer
putInt
public ByteBuffer putInt(int value)
- Description copied from class:
ByteBuffer - Relative put method for writing an integer value.
- Specified by:
putIntin classByteBuffer
getInt
public int getInt(int index)
- Description copied from class:
ByteBuffer - Absolute get method for reading an integer value.
- Specified by:
getIntin classByteBuffer
putInt
public ByteBuffer putInt(int index, int value)
- Description copied from class:
ByteBuffer - Absolute put method for writing an integer value.
- Specified by:
putIntin classByteBuffer
getLong
public long getLong()
- Description copied from class:
ByteBuffer - Relative get method for reading a long value.
- Specified by:
getLongin classByteBuffer
putLong
public ByteBuffer putLong(long value)
- Description copied from class:
ByteBuffer - Relative put method for writing a long value.
- Specified by:
putLongin classByteBuffer
getLong
public long getLong(int index)
- Description copied from class:
ByteBuffer - Absolute get method for reading a long value.
- Specified by:
getLongin classByteBuffer
putLong
public ByteBuffer putLong(int index, long value)
- Description copied from class:
ByteBuffer - Absolute put method for writing a float value.
- Specified by:
putLongin classByteBuffer
getFloat
public float getFloat()
- Description copied from class:
ByteBuffer - Relative get method for reading a float value.
- Specified by:
getFloatin classByteBuffer
putFloat
public ByteBuffer putFloat(float value)
- Description copied from class:
ByteBuffer - Relative put method for writing a float value.
- Specified by:
putFloatin classByteBuffer
getFloat
public float getFloat(int index)
- Description copied from class:
ByteBuffer - Absolute get method for reading a float value.
- Specified by:
getFloatin classByteBuffer
putFloat
public ByteBuffer putFloat(int index, float value)
- Description copied from class:
ByteBuffer - Relative put method for writing a float value.
- Specified by:
putFloatin classByteBuffer
getDouble
public double getDouble()
- Description copied from class:
ByteBuffer - Relative get method for reading a double value.
- Specified by:
getDoublein classByteBuffer
putDouble
public ByteBuffer putDouble(double value)
- Description copied from class:
ByteBuffer - Relative put method for writing a double value.
- Specified by:
putDoublein classByteBuffer
getDouble
public double getDouble(int index)
- Description copied from class:
ByteBuffer - Absolute get method for reading a double value.
- Specified by:
getDoublein classByteBuffer
putDouble
public ByteBuffer putDouble(int index, double value)
- Description copied from class:
ByteBuffer - Absolute put method for writing a double value.
- Specified by:
putDoublein classByteBuffer
|
|||||||||
| Home >> All >> java >> [ nio overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC