public void skipRawBytes(final int size) throws IOException {
    if (size < 0) {
      throw ProtobufException.negativeSize();
    }

    if (totalBytesRetired + bufferPos + size > currentLimit) {
      // Read to the end of the stream anyway.
      skipRawBytes(currentLimit - totalBytesRetired - bufferPos);
      // Then fail.
      throw ProtobufException.truncatedMessage();
    }

    if (size <= bufferSize - bufferPos) {
      // We have all the bytes we need already.
      bufferPos += size;
    } else {
      // Skipping more bytes than are in the buffer.  First skip what we have.
      int pos = bufferSize - bufferPos;
      bufferPos = bufferSize;

      // Keep refilling the buffer until we get to the point we wanted to skip
      // to.  This has the side effect of ensuring the limits are updated
      // correctly.
      refillBuffer(true);
      while (size - pos > bufferSize) {
        pos += bufferSize;
        bufferPos = bufferSize;
        refillBuffer(true);
      }

      bufferPos = size - pos; 
    }
  }
public void skipRawBytes ( final int size ) throws IOException { if ( size < 0 ) { throw ProtobufException . negativeSize ( ) ; } if ( totalBytesRetired + bufferPos + size > currentLimit ) { skipRawBytes ( currentLimit - totalBytesRetired - bufferPos ) ; throw ProtobufException . truncatedMessage ( ) ; } if ( size <= bufferSize - bufferPos ) { bufferPos += size ; } else { int pos = bufferSize - bufferPos ; bufferPos = bufferSize ; refillBuffer ( true ) ; while ( size - pos > bufferSize ) { pos += bufferSize ; bufferPos = bufferSize ; refillBuffer ( true ) ; } bufferPos = size - pos ; } }
Reads and discards {@code size} bytes.

@throws ProtobufException The end of the stream or the current
limit was reached.