Package java.nio

Examples of java.nio.BufferUnderflowException


     * {@inheritDoc}
     */
    public float getFloat( int pos ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 4 > limit() )
            throw new BufferUnderflowException();
        int value;
        synchronized ( this ) {
            value = getRAF( offsetPos ).readInt();
        }
        if ( order() == ByteOrder.LITTLE_ENDIAN )
View Full Code Here


     * {@inheritDoc}
     */
    public int getInt( int pos ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 4 > limit() )
            throw new BufferUnderflowException();
        final int value;
        synchronized ( this ) {
            value = getRAF( offsetPos ).readInt();
        }
        return  order() == ByteOrder.BIG_ENDIAN ?
View Full Code Here

     * {@inheritDoc}
     */
    public long getLong( int pos ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 8 > limit() )
            throw new BufferUnderflowException();
        final long value;
        synchronized ( this ) {
            value = getRAF( offsetPos ).readLong();
        }
        return  order() == ByteOrder.BIG_ENDIAN ?
View Full Code Here

     * {@inheritDoc}
     */
    public short getShort( int pos ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 2 > limit() )
            throw new BufferUnderflowException();
        final short value;
        synchronized ( this ) {
            value = getRAF( offsetPos ).readShort();
        }
        return  order() == ByteOrder.BIG_ENDIAN ?
View Full Code Here

     * {@inheritDoc}
     */
    public byte get( int pos ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 1 > limit() )
            throw new BufferUnderflowException();
        return getChunkForPos( offsetPos ).get( offsetPos % CHUNK_SIZE );
    }
View Full Code Here

     * position.
     */
    private long get248Bytes( int pos, int length ) throws IOException {
        final int endPos = pos + length;
        if ( endPos > limit() )
            throw new BufferUnderflowException();
        final int lastPos = endPos - 1;
        final ByteBuffer chunkI = getChunkForPos( pos );
        final ByteBuffer chunkJ = getChunkForPos( lastPos );
        final int modI = pos % CHUNK_SIZE;
        if ( chunkI == chunkJ ) {
View Full Code Here

        catch ( IndexOutOfBoundsException e ) {
            //
            // Morph an IndexOutOfBoundsException to a BufferUnderflowException
            // for consistency.
            //
            final BufferUnderflowException bue = new BufferUnderflowException();
            bue.initCause( e );
            throw bue;
        }
    }
View Full Code Here

     */
    private byte[] getContiguousBytes( int pos, byte[] dest, int offset,
                                       int length ) throws IOException {
        final int endPos = pos + length;
        if ( endPos > limit() )
            throw new BufferUnderflowException();
        final int lastPos = endPos - 1;
        final ByteBuffer chunkI = getChunkForPos( pos );
        final ByteBuffer chunkJ = getChunkForPos( lastPos );
        final int modI = pos % CHUNK_SIZE;
        if ( chunkI == chunkJ ) {
View Full Code Here

            }
            int length = bb.getInt();
            if (length < 0) {
                throw new IOException("Length " + length + " is invalid");
            } else if (length > bb.remaining()) {
                throw new BufferUnderflowException();
            }
            masterKey = new byte[length];
            bb.get(masterKey);
            stateBits = bb.getInt();
            needFlushHeader = false;
View Full Code Here

        int oldPos = position();
        int oldLimit = limit();
        int end = oldPos + fieldSize;

        if (oldLimit < end) {
            throw new BufferUnderflowException();
        }

        int i;

        if (!utf16) {
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.