public final static byte [ ] consumeBytes ( byte [ ] in , int numBytesMax ) { int limit = Math . min ( in . length , numBytesMax ) ; byte [ ] out = new byte [ limit ] ; System . arraycopy ( in , 0 , out , 0 , limit ) ; return out ; }
Consumes bytes from an input buffer and returns them in an output buffer .