Package java.nio

Examples of java.nio.BufferOverflowException


        byte[] b, int offset){
      if(readIndex<minIndex){
        throw new BufferUnderflowException();
      }
      if(readIndex>=index){
        throw new BufferOverflowException();
      }
      int k=(int)(readIndex%bufferSize);
      readBuffer.position(k*streamMaxSize+readOffset);
      int l=lengths[k];
      if(readLength<0){
        l-=readOffset;
        readBuffer.get(b,offset,l);
      }
      else{
        if(l-readOffset<readLength){
          throw new BufferOverflowException();
        }
        l=readLength;
        readBuffer.get(b,offset,l);
      }

View Full Code Here


    public int getLength(int readIndex){
      if(readIndex<minIndex){
        throw new BufferUnderflowException();
      }
      if(readIndex>=index){
        throw new BufferOverflowException();
      }
      int l=lengths[(int)(readIndex%bufferSize)];
      // cross check for concurent access
      if(readIndex<minIndex){
        throw new BufferUnderflowException();
View Full Code Here

    private void reserve(int len) throws IOException {
        if(len <= buffer.remaining()) {
            return;
        }
        if(callback == null) {
            throw new BufferOverflowException();
        }
        buffer = callback.call(buffer, len);
    }
View Full Code Here

     * {@inheritDoc}
     */
    public FileByteBuffer put( int pos, byte value ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 1 > limit() )
            throw new BufferOverflowException();
        synchronized ( this ) {
            getRAF( offsetPos ).writeByte( value );
        }
        return this;
    }
View Full Code Here

    public FileByteBuffer putDouble( int pos, double value )
        throws IOException
    {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 8 > limit() )
            throw new BufferOverflowException();
        long valueAsLong = Double.doubleToLongBits( value );
        if ( order() == ByteOrder.LITTLE_ENDIAN )
            valueAsLong = Long.reverseBytes( valueAsLong );
        synchronized ( this ) {
            getRAF( offsetPos ).writeLong( valueAsLong );
View Full Code Here

     * {@inheritDoc}
     */
    public FileByteBuffer putFloat( int pos, float value ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 4 > limit() )
            throw new BufferOverflowException();
        int valueAsInt = Float.floatToIntBits( value );
        if ( order() == ByteOrder.LITTLE_ENDIAN )
            valueAsInt = Integer.reverseBytes( valueAsInt );
        synchronized ( this ) {
            getRAF( offsetPos ).writeInt( valueAsInt );
View Full Code Here

     * {@inheritDoc}
     */
    public FileByteBuffer putInt( int pos, int value ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 4 > limit() )
            throw new BufferOverflowException();
        if ( order() == ByteOrder.LITTLE_ENDIAN )
            value = Integer.reverseBytes( value );
        synchronized ( this ) {
            getRAF( offsetPos ).writeInt( value );
        }
View Full Code Here

     * {@inheritDoc}
     */
    public FileByteBuffer putLong( int pos, long value ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 8 > limit() )
            throw new BufferOverflowException();
        if ( order() == ByteOrder.LITTLE_ENDIAN )
            value = Long.reverseBytes( value );
        synchronized ( this ) {
            getRAF( offsetPos ).writeLong( value );
        }
View Full Code Here

     * {@inheritDoc}
     */
    public FileByteBuffer putShort( int pos, short value ) throws IOException {
        final int offsetPos = initialOffset() + pos;
        if ( offsetPos + 2 > limit() )
            throw new BufferOverflowException();
        if ( order() == ByteOrder.LITTLE_ENDIAN )
            value = Short.reverseBytes( value );
        synchronized ( this ) {
            getRAF( offsetPos ).writeShort( value );
        }
View Full Code Here

        maxChunks = chunksPerPkt;
      }

      void writeData(byte[] inarray, int off, int len) {
        if ( dataPos + len > buf.length) {
          throw new BufferOverflowException();
        }
        System.arraycopy(inarray, off, buf, dataPos, len);
        dataPos += len;
      }
View Full Code Here

TOP

Related Classes of java.nio.BufferOverflowException

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.