Save This Page
Home » openjdk-7 » java » nio » [javadoc | source]
java.nio
abstract public class: ByteBuffer [javadoc | source]
java.lang.Object
   java.nio.Buffer
      java.nio.ByteBuffer

All Implemented Interfaces:
    Comparable

Direct Known Subclasses:
    ReadOnly, ByteBufferImpl, DirectByteBufferImpl, MappedByteBuffer, ReadWrite, MappedByteBufferImpl

Field Summary
 ByteOrder endian     
 int array_offset     
 byte[] backing_buffer     
Fields inherited from java.nio.Buffer:
address
Constructor:
 ByteBuffer(int capacity,
    int limit,
    int position,
    int mark) 
Method from java.nio.ByteBuffer Summary:
allocate,   allocateDirect,   array,   arrayOffset,   asCharBuffer,   asDoubleBuffer,   asFloatBuffer,   asIntBuffer,   asLongBuffer,   asReadOnlyBuffer,   asShortBuffer,   compact,   compareTo,   duplicate,   equals,   get,   get,   get,   get,   getChar,   getChar,   getDouble,   getDouble,   getFloat,   getFloat,   getInt,   getInt,   getLong,   getLong,   getShort,   getShort,   hasArray,   hashCode,   isDirect,   order,   order,   put,   put,   put,   put,   put,   putChar,   putChar,   putDouble,   putDouble,   putFloat,   putFloat,   putInt,   putInt,   putLong,   putLong,   putShort,   putShort,   shiftDown,   slice,   toString,   wrap,   wrap
Methods from java.nio.Buffer:
array,   arrayOffset,   capacity,   checkBounds,   checkIndex,   checkIndex,   clear,   flip,   hasArray,   hasRemaining,   isDirect,   isReadOnly,   limit,   limit,   mark,   markValue,   nextGetIndex,   nextGetIndex,   nextPutIndex,   nextPutIndex,   position,   position,   remaining,   reset,   rewind
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.nio.ByteBuffer Detail:
 public static ByteBuffer allocate(int capacity) 
    Allocates a new ByteBuffer object with a given capacity.
 public static ByteBuffer allocateDirect(int capacity) 
    Allocates a new direct byte buffer.
 public final byte[] array() 
    Returns the byte array that backs this buffer.
 public final int arrayOffset() 
    Returns the offset within this buffer's backing array of the first element.
 abstract public CharBuffer asCharBuffer()
    Creates a view of this byte buffer as a char buffer.
 abstract public DoubleBuffer asDoubleBuffer()
    Creates a view of this byte buffer as a double buffer.
 abstract public FloatBuffer asFloatBuffer()
    Creates a view of this byte buffer as a float buffer.
 abstract public IntBuffer asIntBuffer()
    Creates a view of this byte buffer as an integer buffer.
 abstract public LongBuffer asLongBuffer()
    Creates a view of this byte buffer as a long buffer.
 abstract public ByteBuffer asReadOnlyBuffer()
    Creates a new read-only ByteBuffer that shares this buffer's content.
 abstract public ShortBuffer asShortBuffer()
    Creates a view of this byte buffer as a short buffer.
 abstract public ByteBuffer compact()
    Compacts this buffer.
 public int compareTo(Object obj) 
    Compares two ByteBuffer objects.
 abstract public ByteBuffer duplicate()
    Creates a new ByteBuffer that shares this buffer's content.
 public boolean equals(Object obj) 
    Checks if this buffer is equal to obj.
 abstract public byte get()
    Reads the byte at this buffer's current position, and then increments the position.
 public ByteBuffer get(byte[] dst) 
    This method transfers bytes from this buffer into the given destination array.
 abstract public byte get(int index)
    Absolute get method.
 public ByteBuffer get(byte[] dst,
    int offset,
    int length) 
    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.
 abstract public char getChar()
    Relative get method for reading a character value.
 abstract public char getChar(int index)
    Absolute get method for reading a character value.
 abstract public double getDouble()
    Relative get method for reading a double value.
 abstract public double getDouble(int index)
    Absolute get method for reading a double value.
 abstract public float getFloat()
    Relative get method for reading a float value.
 abstract public float getFloat(int index)
    Absolute get method for reading a float value.
 abstract public int getInt()
    Relative get method for reading an integer value.
 abstract public int getInt(int index)
    Absolute get method for reading an integer value.
 abstract public long getLong()
    Relative get method for reading a long value.
 abstract public long getLong(int index)
    Absolute get method for reading a long value.
 abstract public short getShort()
    Relative get method for reading a short value.
 abstract public short getShort(int index)
    Absolute get method for reading a short value.
 public final boolean hasArray() 
    Tells whether ot not this buffer is backed by an accessible byte array.
 public int hashCode() 
    Calculates a hash code for this buffer. This is done with int arithmetic, where ** represents exponentiation, by this formula:
    s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... + (s[limit()-1]+30)*31**(limit()-1). Where s is the buffer data. Note that the hashcode is dependent on buffer content, and therefore is not useful if the buffer content may change.
 abstract public boolean isDirect()
    Tells whether or not this buffer is direct.
 public final ByteOrder order() 
    Returns the byte order of this buffer.
 public final ByteBuffer order(ByteOrder endian) 
    Modifies this buffer's byte order.
 public ByteBuffer put(ByteBuffer src) 
    Writes the content of the the ByteBUFFER src into the buffer. Before the transfer, it checks if there is fewer than src.remaining() space remaining in this buffer.
 public final ByteBuffer put(byte[] src) 
    Writes the content of the the byte array src into the buffer.
 abstract public ByteBuffer put(byte b)
    Writes the byte at this buffer's current position, and then increments the position.
 abstract public ByteBuffer put(int index,
    byte b)
    Absolute put method.
 public ByteBuffer put(byte[] src,
    int offset,
    int length) 
    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.
 abstract public ByteBuffer putChar(char value)
    Relative put method for writing a character value.
 abstract public ByteBuffer putChar(int index,
    char value)
    Absolute put method for writing a character value.
 abstract public ByteBuffer putDouble(double value)
    Relative put method for writing a double value.
 abstract public ByteBuffer putDouble(int index,
    double value)
    Absolute put method for writing a double value.
 abstract public ByteBuffer putFloat(float value)
    Relative put method for writing a float value.
 abstract public ByteBuffer putFloat(int index,
    float value)
    Relative put method for writing a float value.
 abstract public ByteBuffer putInt(int value)
    Relative put method for writing an integer value.
 abstract public ByteBuffer putInt(int index,
    int value)
    Absolute put method for writing an integer value.
 abstract public ByteBuffer putLong(long value)
    Relative put method for writing a long value.
 abstract public ByteBuffer putLong(int index,
    long value)
    Absolute put method for writing a float value.
 abstract public ByteBuffer putShort(short value)
    Relative put method for writing a short value.
 abstract public ByteBuffer putShort(int index,
    short value)
    Absolute put method for writing a short value.
  void shiftDown(int dst_offset,
    int src_offset,
    int count) 
 abstract public ByteBuffer slice()
    Creates a new ByteBuffer whose content is a shared subsequence of this buffer's content.
 public String toString() 
    Returns a string summarizing the state of this buffer.
 public static final ByteBuffer wrap(byte[] array) 
    Wraps a byte array into a ByteBuffer object.
 public static final ByteBuffer wrap(byte[] array,
    int offset,
    int length) 
    Wraps a byte array into a ByteBuffer object.