question: private byte [ ] readRawBytesSlowPath ( final int size ) throws IOException { if ( size <= 0 ) { if ( size == 0 ) { return Internal . EMPTY_BYTE_ARRAY ; } else { throw InvalidProtocolBufferException . negativeSize ( ) ; } } if ( totalBytesRetired + bufferPos + size > currentLimit ) { skipRawBytes ( currentLimit - totalBytesRetired - bufferPos ) ; throw InvalidProtocolBufferException . truncatedMessage ( ) ; } if ( size < BUFFER_SIZE ) { final byte [ ] bytes = new byte [ size ] ; int pos = bufferSize - bufferPos ; System . arraycopy ( buffer , bufferPos , bytes , 0 , pos ) ; bufferPos = bufferSize ; ensureAvailable ( size - pos ) ; System . arraycopy ( buffer , 0 , bytes , pos , size - pos ) ; bufferPos = size - pos ; return bytes ; } else { final int originalBufferPos = bufferPos ; final int originalBufferSize = bufferSize ; totalBytesRetired += bufferSize ; bufferPos = 0 ; bufferSize = 0 ; int sizeLeft = size - ( originalBufferSize - originalBufferPos ) ; final List < byte [ ] > chunks = new ArrayList < byte [ ] > ( ) ; while ( sizeLeft > 0 ) { final byte [ ] chunk = new byte [ Math . min ( sizeLeft , BUFFER_SIZE ) ] ; int pos = 0 ; while ( pos < chunk . length ) { final int n = ( input == null ) ? - 1 : input . read ( chunk , pos , chunk . length - pos ) ; if ( n == - 1 ) { throw InvalidProtocolBufferException . truncatedMessage ( ) ; } totalBytesRetired += n ; pos += n ; } sizeLeft -= chunk . length ; chunks . add ( chunk ) ; } final byte [ ] bytes = new byte [ size ] ; int pos = originalBufferSize - originalBufferPos ; System . arraycopy ( buffer , originalBufferPos , bytes , 0 , pos ) ; for ( final byte [ ] chunk : chunks ) { System . arraycopy ( chunk , 0 , bytes , pos , chunk . length ) ; pos += chunk . length ; } return bytes ; } }
target:  Exactly like readRawBytes, but caller must have already checked the fast path: (size <= (bufferSize - pos) && size > 0)