FileDocCategorySizeDatePackage
IntBufferImpl.javaAPI DocphoneME MR2 API (J2ME)3441Wed May 02 18:00:48 BST 2007java.nio

IntBufferImpl

public class IntBufferImpl extends IntBuffer
A Buffer storing int data.

Fields Summary
Constructors Summary
IntBufferImpl(ByteBufferImpl parent, int capacity, int[] array, int arrayOffset, boolean isDirect)

        this.parent = parent;
	this.isDirect = isDirect;
	this.array = array;
	this.arrayOffset = arrayOffset;
	this.capacity = this.limit = capacity;
	this.position = 0;
    
Methods Summary
public voiddispose()

        // Need revisit
        this.disposed = true;
    
public intget()

        if (position >= limit) {
            throw new BufferUnderflowException();
        }
	return get(position++);
    
public intget(int index)

        if (index < 0 || index >= limit) {
            throw new IndexOutOfBoundsException();
        }

        int bytePtr = arrayOffset + (index << 2);
	if (isDirect) {
            return ByteBufferImpl._getInt(bytePtr);
	} else if (array != null) {
            return array[arrayOffset + index]; 
	} else {
            return parent.getInt(bytePtr);
        }
    
public booleanisDirect()

	return isDirect;
    
public intnativeAddress()

	return arrayOffset;
    
public java.nio.IntBufferput(int i)

        if (position >= limit) {
            throw new BufferOverflowException();
        }
	return put(position++, i);
    
public java.nio.IntBufferput(int index, int i)

        if (index < 0 || index >= limit) {
            throw new IndexOutOfBoundsException();
        }

        int bytePtr = arrayOffset + (index << 2);
	if (isDirect) {
	    ByteBufferImpl._putInt(bytePtr, i);
	} else if (array != null) {
	    array[arrayOffset + index] = i;
	} else {
            parent.putInt(bytePtr, i);
        }
	return this;
    
public java.nio.IntBufferslice()

        int pos = position;
        if (isDirect) {
            pos <<= 2;
        }
        return new IntBufferImpl(parent, limit - position, array,
                                 arrayOffset + pos,
                                 isDirect);