Package java.nio

Examples of java.nio.BufferUnderflowException


     * @return the number of bytes read
     */
    public int read(long readIndex, int readOffset, int readLength,
        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);
      }

      // cross check for concurent access
      if(readIndex<minIndex){
        throw new BufferUnderflowException();
      }
      return l;
    }
View Full Code Here


     * @param readIndex the index of the packet
     * @return the number of bytes in this packet
     */
    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();
      }
      return l;
    }
View Full Code Here

    int length = stream.readInt();
    if (stream.available() < length) {
      if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("insufficient data. require " + length + " got "  + stream.available());
      }
      throw new BufferUnderflowException();
 
    } else {
      // ...yes, remove mark
      if  (!removeLengthField) {
        stream.resetToReadMark();
View Full Code Here

    int length = stream.readInt();
    if (stream.available() < length) {
      if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("insufficient data. require " + length + " got "  + stream.available());
      }
      throw new BufferUnderflowException();
 
    } else {
      // ...yes, remove mark
      if  (!removeLengthField) {
        stream.resetToReadMark();
View Full Code Here

                }
            }
        }
     
        if ((data == null) || (data.length < BOM_MAX_LENGTH)) {
            throw new BufferUnderflowException();
        }
        return null;
   
View Full Code Here

    int length = stream.readInt();
    if (stream.available() < length) {
      if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("insufficient data. require " + length + " got "  + stream.available());
      }
      throw new BufferUnderflowException();
 
    } else {
      // ...yes, remove mark
      if  (!removeLengthField) {
        stream.resetToReadMark();
View Full Code Here

    int length = stream.readInt();
    if (stream.available() < length) {
      if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("insufficient data. require " + length + " got "  + stream.available());
      }
      throw new BufferUnderflowException();
 
    } else {
      // ...yes, remove mark
      if  (!removeLengthField) {
        stream.resetToReadMark();
View Full Code Here

    int length = stream.readInt();
    if (stream.available() < length) {
      if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("insufficient data. require " + length + " got "  + stream.available());
      }
      throw new BufferUnderflowException();
 
    } else {
      // ...yes, remove mark
      if  (!removeLengthField) {
        stream.resetToReadMark();
View Full Code Here

                }
            }
        }
     
        if ((data == null) || (data.length < BOM_MAX_LENGTH)) {
            throw new BufferUnderflowException();
        }
        return null;
   
View Full Code Here

        int length = stream.readInt();
        if (stream.available() < length) {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("insufficient data. require " + length + " got "  + stream.available());
            }
            throw new BufferUnderflowException();
   
        } else {
            // ...yes, remove mark
            if  (!removeLengthField) {
                stream.resetToReadMark();
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.