Build 1.0_r1(from source)

java.nio
Class IntToByteBufferAdapter

java.lang.Object
  extended by java.nio.Buffer
      extended by java.nio.IntBuffer
          extended by java.nio.IntToByteBufferAdapter
All Implemented Interfaces:
Comparable<IntBuffer>, org.apache.harmony.nio.internal.DirectBuffer

final class IntToByteBufferAdapter
extends IntBuffer
implements org.apache.harmony.nio.internal.DirectBuffer

This class wraps a byte buffer to be a int buffer.

Implementation notice:


Field Summary
 
Fields inherited from class java.nio.Buffer
_elementSizeShift, capacity, limit, mark, position, UNSET_MARK
 
Constructor Summary
IntToByteBufferAdapter(ByteBuffer byteBuffer)
           
 
Method Summary
 void addressValidityCheck()
           
 IntBuffer asReadOnlyBuffer()
          Returns a readonly buffer that shares content with this buffer.
 IntBuffer compact()
          Compacts this int buffer.
 IntBuffer duplicate()
          Returns a duplicated buffer that shares content with this buffer.
 void free()
           
 int get()
          Returns the int at the current position and increase the position by 1.
 int get(int index)
          Returns a int 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 ints from/to bytes.
protected  int[] 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().
 IntBuffer put(int c)
          Writes the given int to the current position and increase the position by 1.
 IntBuffer put(int[] i, int off, int len)
          Writes ints in the given int array, starting from the specified offset, to the current position and increase the position by the number of ints written.
 IntBuffer put(int index, int c)
          Write a int to the specified index of this buffer and the position is not changed.
 IntBuffer slice()
          Returns a sliced buffer that shares content with this buffer.
(package private) static IntBuffer wrap(ByteBuffer byteBuffer)
           
 
Methods inherited from class java.nio.IntBuffer
_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

IntToByteBufferAdapter

IntToByteBufferAdapter(ByteBuffer byteBuffer)
Method Detail

wrap

static IntBuffer wrap(ByteBuffer byteBuffer)

getByteCapacity

public int getByteCapacity()
Specified by:
getByteCapacity in interface org.apache.harmony.nio.internal.DirectBuffer

getEffectiveAddress

public org.apache.harmony.luni.platform.PlatformAddress getEffectiveAddress()
Specified by:
getEffectiveAddress in interface org.apache.harmony.nio.internal.DirectBuffer

getBaseAddress

public org.apache.harmony.luni.platform.PlatformAddress getBaseAddress()
Specified by:
getBaseAddress in interface org.apache.harmony.nio.internal.DirectBuffer

isAddressValid

public boolean isAddressValid()
Specified by:
isAddressValid in interface org.apache.harmony.nio.internal.DirectBuffer

addressValidityCheck

public void addressValidityCheck()
Specified by:
addressValidityCheck in interface org.apache.harmony.nio.internal.DirectBuffer

free

public void free()
Specified by:
free in interface org.apache.harmony.nio.internal.DirectBuffer

asReadOnlyBuffer

public IntBuffer asReadOnlyBuffer()
Description copied from class: IntBuffer
Returns a readonly buffer that shares content with this buffer.

The 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.

Specified by:
asReadOnlyBuffer in class IntBuffer
Returns:
A readonly version of this buffer.

compact

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

The remaining ints 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.

Specified by:
compact in class IntBuffer
Returns:
This buffer

duplicate

public IntBuffer duplicate()
Description copied from class: IntBuffer
Returns a duplicated buffer that shares content with this buffer.

The 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.

Specified by:
duplicate in class IntBuffer
Returns:
A duplicated buffer that shares content with this buffer.

get

public int get()
Description copied from class: IntBuffer
Returns the int at the current position and increase the position by 1.

Specified by:
get in class IntBuffer
Returns:
The int at the current position.

get

public int get(int index)
Description copied from class: IntBuffer
Returns a int at the specified index, and the position is not changed.

Specified by:
get in class IntBuffer
Parameters:
index - The index, must be no less than zero and less than limit
Returns:
A int at the specified index.

isDirect

public boolean isDirect()
Description copied from class: IntBuffer
Returns true if this buffer is direct.

A int buffer is direct, if it is based on a byte buffer and the byte buffer is direct.

Specified by:
isDirect in class IntBuffer
Returns:
True if this buffer is direct.

isReadOnly

public boolean isReadOnly()
Description copied from class: Buffer
Returns whether this buffer is readonly or not.

Specified by:
isReadOnly in class Buffer
Returns:
Whether this buffer is readonly or not.

order

public ByteOrder order()
Description copied from class: IntBuffer
Returns the byte order used by this buffer when converting ints from/to bytes.

If this buffer is not based on a byte buffer, then always return the platform's native byte order.

Specified by:
order in class IntBuffer
Returns:
The byte order used by this buffer when converting ints from/to bytes.

protectedArray

protected int[] protectedArray()
Description copied from class: IntBuffer
Child class implements this method to realize array().

Specified by:
protectedArray in class IntBuffer
Returns:
see array()

protectedArrayOffset

protected int protectedArrayOffset()
Description copied from class: IntBuffer
Child class implements this method to realize arrayOffset().

Specified by:
protectedArrayOffset in class IntBuffer
Returns:
see arrayOffset()

protectedHasArray

protected boolean protectedHasArray()
Description copied from class: IntBuffer
Child class implements this method to realize hasArray().

Specified by:
protectedHasArray in class IntBuffer
Returns:
see hasArray()

put

public IntBuffer put(int c)
Description copied from class: IntBuffer
Writes the given int to the current position and increase the position by 1.

Specified by:
put in class IntBuffer
Parameters:
c - The int to write
Returns:
This buffer

put

public IntBuffer put(int index,
                     int c)
Description copied from class: IntBuffer
Write a int to the specified index of this buffer and the position is not changed.

Specified by:
put in class IntBuffer
Parameters:
index - The index, must be no less than zero and less than the limit
c - The int to write
Returns:
This buffer

put

public IntBuffer put(int[] i,
                     int off,
                     int len)
Description copied from class: IntBuffer
Writes ints in the given int array, starting from the specified offset, to the current position and increase the position by the number of ints written.

Overrides:
put in class IntBuffer
Parameters:
i - The source int array
off - The offset of int array, must be no less than zero and no greater than src.length
len - The number of ints to write, must be no less than zero and no greater than src.length - off
Returns:
This buffer

slice

public IntBuffer slice()
Description copied from class: IntBuffer
Returns a sliced buffer that shares content with this buffer.

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.

Specified by:
slice in class IntBuffer
Returns:
A sliced buffer that shares content with this buffer.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature