Package java.nio

Examples of java.nio.BufferUnderflowException


     */
    public Object getObject( final ClassLoader classLoader ) throws ClassNotFoundException
    {
        if( !prefixedDataAvailable( 4 ) )
        {
            throw new BufferUnderflowException();
        }

        int length = getInt();
        if( length <= 4 )
        {
View Full Code Here


    /**
     * @see ByteBuffer#get()
     */
    public byte get() {
        if (!hasRemaining()) {
            throw new BufferUnderflowException();
        }

        return get(position);
    }
View Full Code Here

    /**
     * @see ByteBuffer#get(byte[], int,int)
     */
    public IoBuffer get(byte[] dst, int offset, int length) {
        if (remaining() < length) {
            throw new BufferUnderflowException();
        }
        int remainsToCopy = length;
        int currentOffset = offset;

        while (remainsToCopy > 0) {
View Full Code Here

        return getInt(getPointerByPosition(index));
    }

    private int getInt(Pointer pos) {
        if (pos.getPosition() > capacity - Integer.SIZE / Byte.SIZE) {
            throw new BufferUnderflowException();
        }

        int out = 0;
        for (int i = 0; i < Integer.SIZE; i += Byte.SIZE) {
            out |= (get(pos) & BYTE_MASK) << (bo == ByteOrder.BIG_ENDIAN ? (Integer.SIZE - Byte.SIZE) - i : i);
View Full Code Here

        return getLong(getPointerByPosition(index));
    }

    private long getLong(Pointer pos) {
        if (pos.getPosition() > capacity - Long.SIZE / Byte.SIZE) {
            throw new BufferUnderflowException();
        }

        long out = 0;
        for (int i = 0; i < Long.SIZE; i += Byte.SIZE) {
            out |= (get(pos) & BYTE_MASK_L) << (bo == ByteOrder.BIG_ENDIAN ? (Long.SIZE - Byte.SIZE) - i : i);
View Full Code Here

        return getShort(getPointerByPosition(index));
    }

    private short getShort(Pointer pos) {
        if (pos.getPosition() > capacity - Short.SIZE / Byte.SIZE) {
            throw new BufferUnderflowException();
        }
        if (bo == ByteOrder.BIG_ENDIAN) {
            return (short) ((get(pos) & BYTE_MASK) << Byte.SIZE | (get(pos) & BYTE_MASK));
        } else {
            return (short) ((get(pos) & BYTE_MASK) | (get(pos) & BYTE_MASK) << Byte.SIZE);
View Full Code Here

    public IoBuffer put(byte b) {
        if (readonly) {
            throw new ReadOnlyBufferException();
        }
        if (position.getPosition() >= limit.getPosition()) {
            throw new BufferUnderflowException();
        }

        put(position, b);
        return this;
    }
View Full Code Here

    public IoBuffer put(byte[] src, int offset, int length) {
        if (readonly) {
            throw new ReadOnlyBufferException();
        }
        if (remaining() < length) {
            throw new BufferUnderflowException();
        }

        int remainsToCopy = length;
        int currentOffset = offset;
        position.getNode().getBuffer().position(position.getPositionInNode());
View Full Code Here

    }

    private IoBuffer putInt(Pointer pointer, int value) {
        if (position.getPosition() > pointer.getPosition()
                || pointer.getPosition() > limit.getPosition() - Integer.SIZE / Byte.SIZE) {
            throw new BufferUnderflowException();
        }
        for (int i = 0; i < Integer.SIZE; i += Byte.SIZE) {
            put(pointer, (byte) (value >> (bo == ByteOrder.BIG_ENDIAN ? (Integer.SIZE - Byte.SIZE) - i : i)));
        }
        return this;
View Full Code Here

    }

    private IoBuffer putLong(Pointer pointer, long value) {
        if (position.getPosition() > pointer.getPosition()
                || pointer.getPosition() > limit.getPosition() - Long.SIZE / Byte.SIZE) {
            throw new BufferUnderflowException();
        }
        for (int i = 0; i < Long.SIZE; i += Byte.SIZE) {
            put(pointer, (byte) (value >> (bo == ByteOrder.BIG_ENDIAN ? (Long.SIZE - Byte.SIZE) - i : i)));
        }
View Full Code Here

TOP

Related Classes of java.nio.BufferUnderflowException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.