Code example for ByteBuffer

Methods: get, position, remaining, slice

0
	} 
 
	@Override 
	protected int setInput(final int pos, final Inflater inf)
			throws DataFormatException { 
		final ByteBuffer s = buffer.slice();
		s.position(pos);
		final byte[] tmp = new byte[Math.min(s.remaining(), 512)];
		s.get(tmp, 0, tmp.length);
		inf.setInput(tmp, 0, tmp.length);
		return tmp.length;
	} 
}