BufferRecycler { public byte[] allocDecodeBuffer(int size) { byte[] buf = decodingBuffer; if (buf == null || buf.length < size) { buf = new byte[size]; } else { decodingBuffer = null; } return buf; }  static BufferRecycler instance(); byte[] allocEncodingBuffer(int minSize); void releaseEncodeBuffer(byte[] buffer); byte[] allocOutputBuffer(int minSize); void releaseOutputBuffer(byte[] buffer); short[] allocEncodingHash(int suggestedSize); void releaseEncodingHash(short[] buffer); byte[] allocInputBuffer(int minSize); void releaseInputBuffer(byte[] buffer); byte[] allocDecodeBuffer(int size); void releaseDecodeBuffer(byte[] buffer);  }
@Test public void allocDecodeBuffer() { byte[] b = BufferRecycler.instance().allocDecodeBuffer(10); Assert.assertEquals(10, b.length); BufferRecycler.instance().releaseDecodeBuffer(b); }