Code example for ByteBuffer

Methods: rewind

0
    public long getContentLength() { 
        return this.buffer.limit();
    } 
 
    public void finish() { 
        buffer.rewind();
    } 
 
    public void produceContent(ContentEncoder encoder, IOControl ioctrl)
            throws IOException { 
        encoder.write(buffer);
        if(!buffer.hasRemaining())
            encoder.complete();
    } 
 
    public boolean isStreaming() { 
        return false; 
    } 
 
    public InputStream getContent() {
        return new ByteArrayInputStream(content);