Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.nio
Class DirectByteBufferImpl  view DirectByteBufferImpl download DirectByteBufferImpl.java

java.lang.Object
  extended byjava.nio.Buffer
      extended byjava.nio.ByteBuffer
          extended byjava.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.ref package.

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 byte at this buffer's current position, and then increments the position.

Specified by:
get in class ByteBuffer

get

public byte get(int index)
Description copied from class: ByteBuffer
Absolute get method.

Specified by:
get in class ByteBuffer

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 length bytes remaining in this buffer.

Overrides:
get in class ByteBuffer

put

public ByteBuffer put(byte value)
Description copied from class: ByteBuffer
Writes the byte at this buffer's current position, and then increments the position.

Specified by:
put in class ByteBuffer

put

public ByteBuffer put(int index,
                      byte value)
Description copied from class: ByteBuffer
Absolute put method.

Specified by:
put in class ByteBuffer

put

public ByteBuffer put(byte[] src,
                      int offset,
                      int length)
Description copied from class: ByteBuffer
Writes the content of the the byte array src into the buffer. Before the transfer, it checks if there is fewer than length space remaining in this buffer.

Overrides:
put in class ByteBuffer

shiftDown

void shiftDown(int dst_offset,
               int src_offset,
               int count)
Overrides:
shiftDown in class ByteBuffer

compact

public ByteBuffer compact()
Description copied from class: ByteBuffer
Compacts this buffer.

Specified by:
compact in class ByteBuffer

slice

public ByteBuffer slice()
Description copied from class: ByteBuffer
Creates a new ByteBuffer whose content is a shared subsequence of this buffer's content.

Specified by:
slice in class ByteBuffer

duplicate

private ByteBuffer duplicate(boolean readOnly)

duplicate

public ByteBuffer duplicate()
Description copied from class: ByteBuffer
Creates a new ByteBuffer that shares this buffer's content.

Specified by:
duplicate in class ByteBuffer

asReadOnlyBuffer

public ByteBuffer asReadOnlyBuffer()
Description copied from class: ByteBuffer
Creates a new read-only ByteBuffer that shares this buffer's content.

Specified by:
asReadOnlyBuffer in class ByteBuffer

isDirect

public boolean isDirect()
Description copied from class: ByteBuffer
Tells whether or not this buffer is direct.

Specified by:
isDirect in class ByteBuffer

asCharBuffer

public CharBuffer asCharBuffer()
Description copied from class: ByteBuffer
Creates a view of this byte buffer as a char buffer.

Specified by:
asCharBuffer in class ByteBuffer

asShortBuffer

public ShortBuffer asShortBuffer()
Description copied from class: ByteBuffer
Creates a view of this byte buffer as a short buffer.

Specified by:
asShortBuffer in class ByteBuffer

asIntBuffer

public IntBuffer asIntBuffer()
Description copied from class: ByteBuffer
Creates a view of this byte buffer as an integer buffer.

Specified by:
asIntBuffer in class ByteBuffer

asLongBuffer

public LongBuffer asLongBuffer()
Description copied from class: ByteBuffer
Creates a view of this byte buffer as a long buffer.

Specified by:
asLongBuffer in class ByteBuffer

asFloatBuffer

public FloatBuffer asFloatBuffer()
Description copied from class: ByteBuffer
Creates a view of this byte buffer as a float buffer.

Specified by:
asFloatBuffer in class ByteBuffer

asDoubleBuffer

public DoubleBuffer asDoubleBuffer()
Description copied from class: ByteBuffer
Creates a view of this byte buffer as a double buffer.

Specified by:
asDoubleBuffer in class ByteBuffer

getChar

public char getChar()
Description copied from class: ByteBuffer
Relative get method for reading a character value.

Specified by:
getChar in class ByteBuffer

putChar

public ByteBuffer putChar(char value)
Description copied from class: ByteBuffer
Relative put method for writing a character value.

Specified by:
putChar in class ByteBuffer

getChar

public char getChar(int index)
Description copied from class: ByteBuffer
Absolute get method for reading a character value.

Specified by:
getChar in class ByteBuffer

putChar

public ByteBuffer putChar(int index,
                          char value)
Description copied from class: ByteBuffer
Absolute put method for writing a character value.

Specified by:
putChar in class ByteBuffer

getShort

public short getShort()
Description copied from class: ByteBuffer
Relative get method for reading a short value.

Specified by:
getShort in class ByteBuffer

putShort

public ByteBuffer putShort(short value)
Description copied from class: ByteBuffer
Relative put method for writing a short value.

Specified by:
putShort in class ByteBuffer

getShort

public short getShort(int index)
Description copied from class: ByteBuffer
Absolute get method for reading a short value.

Specified by:
getShort in class ByteBuffer

putShort

public ByteBuffer putShort(int index,
                           short value)
Description copied from class: ByteBuffer
Absolute put method for writing a short value.

Specified by:
putShort in class ByteBuffer

getInt

public int getInt()
Description copied from class: ByteBuffer
Relative get method for reading an integer value.

Specified by:
getInt in class ByteBuffer

putInt

public ByteBuffer putInt(int value)
Description copied from class: ByteBuffer
Relative put method for writing an integer value.

Specified by:
putInt in class ByteBuffer

getInt

public int getInt(int index)
Description copied from class: ByteBuffer
Absolute get method for reading an integer value.

Specified by:
getInt in class ByteBuffer

putInt

public ByteBuffer putInt(int index,
                         int value)
Description copied from class: ByteBuffer
Absolute put method for writing an integer value.

Specified by:
putInt in class ByteBuffer

getLong

public long getLong()
Description copied from class: ByteBuffer
Relative get method for reading a long value.

Specified by:
getLong in class ByteBuffer

putLong

public ByteBuffer putLong(long value)
Description copied from class: ByteBuffer
Relative put method for writing a long value.

Specified by:
putLong in class ByteBuffer

getLong

public long getLong(int index)
Description copied from class: ByteBuffer
Absolute get method for reading a long value.

Specified by:
getLong in class ByteBuffer

putLong

public ByteBuffer putLong(int index,
                          long value)
Description copied from class: ByteBuffer
Absolute put method for writing a float value.

Specified by:
putLong in class ByteBuffer

getFloat

public float getFloat()
Description copied from class: ByteBuffer
Relative get method for reading a float value.

Specified by:
getFloat in class ByteBuffer

putFloat

public ByteBuffer putFloat(float value)
Description copied from class: ByteBuffer
Relative put method for writing a float value.

Specified by:
putFloat in class ByteBuffer

getFloat

public float getFloat(int index)
Description copied from class: ByteBuffer
Absolute get method for reading a float value.

Specified by:
getFloat in class ByteBuffer

putFloat

public ByteBuffer putFloat(int index,
                           float value)
Description copied from class: ByteBuffer
Relative put method for writing a float value.

Specified by:
putFloat in class ByteBuffer

getDouble

public double getDouble()
Description copied from class: ByteBuffer
Relative get method for reading a double value.

Specified by:
getDouble in class ByteBuffer

putDouble

public ByteBuffer putDouble(double value)
Description copied from class: ByteBuffer
Relative put method for writing a double value.

Specified by:
putDouble in class ByteBuffer

getDouble

public double getDouble(int index)
Description copied from class: ByteBuffer
Absolute get method for reading a double value.

Specified by:
getDouble in class ByteBuffer

putDouble

public ByteBuffer putDouble(int index,
                            double value)
Description copied from class: ByteBuffer
Absolute put method for writing a double value.

Specified by:
putDouble in class ByteBuffer