### Question:
LinkedBufferInput extends AbstractInput { public void clear() { if (writable >= 0) { ByteBuffer bb = link.getLast(); link.clear(); bb.position(0); bb.limit(0); link.addLast(bb); writable = bb.capacity(); } else { link.clear(); writable = -1; } } LinkedBufferInput(int bufferSize); int read(byte[] b, int off, int len); boolean tryRefer(BufferReferer ref, int len); byte readByte(); void advance(); byte getByte(); short getShort(); int getInt(); long getLong(); float getFloat(); double getDouble(); void feed(byte[] b); void feed(byte[] b, boolean reference); void feed(byte[] b, int off, int len); void feed(byte[] b, int off, int len, boolean reference); void feed(ByteBuffer b); void feed(ByteBuffer buf, boolean reference); void clear(); void copyReferencedBuffer(); int getSize(); void close();  }### Answer:
@Test public void testClear() throws IOException { byte[] src = new byte[8]; LinkedBufferInput b = new LinkedBufferInput(11); for(int i=0; i < 2; i++) { try { b.readByte(); fail(); } catch(EndOfBufferException eof) { } b.feed(src); b.clear(); assertEndOfBuffer(b); b.feed(src); for(int j=0; j < src.length; j++) { b.readByte(); } b.clear(); } }