Mercurial Hosting > luan
diff src/org/eclipse/jetty/io/nio/IndirectNIOBuffer.java @ 1010:2712133d5bce
simplify Buffer code
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 23 Oct 2016 22:23:50 -0600 |
parents | 3428c60d7cfc |
children | 80cad9086593 |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/nio/IndirectNIOBuffer.java Sun Oct 23 21:28:56 2016 -0600 +++ b/src/org/eclipse/jetty/io/nio/IndirectNIOBuffer.java Sun Oct 23 22:23:50 2016 -0600 @@ -22,41 +22,28 @@ import org.eclipse.jetty.io.ByteArrayBuffer; -public class IndirectNIOBuffer extends ByteArrayBuffer implements NIOBuffer + +public final class IndirectNIOBuffer extends ByteArrayBuffer implements NIOBuffer { - protected final ByteBuffer _buf; + private final ByteBuffer _buf; - /* ------------------------------------------------------------ */ - public IndirectNIOBuffer(int size) - { - super(size,READWRITE,NON_VOLATILE); - _buf = ByteBuffer.wrap(_bytes); - _buf.position(0); - _buf.limit(_buf.capacity()); - } + public IndirectNIOBuffer(int size) + { + super(size,READWRITE,NON_VOLATILE); + _buf = ByteBuffer.wrap(_bytes); + _buf.position(0); + _buf.limit(_buf.capacity()); + } - /* ------------------------------------------------------------ */ - public IndirectNIOBuffer(ByteBuffer buffer,boolean immutable) - { - super(buffer.array(),0,0, immutable?IMMUTABLE:READWRITE,NON_VOLATILE); - if (buffer.isDirect()) - throw new IllegalArgumentException(); - _buf = buffer; - _get=buffer.position(); - _put=buffer.limit(); - buffer.position(0); - buffer.limit(buffer.capacity()); - } - - /* ------------------------------------------------------------ */ - public ByteBuffer getByteBuffer() - { - return _buf; - } + @Override + public ByteBuffer getByteBuffer() + { + return _buf; + } - /* ------------------------------------------------------------ */ - public boolean isDirect() - { - return false; - } + @Override + public boolean isDirect() + { + return false; + } }