Mercurial Hosting > luan
changeset 1050:5ef954fad97b
remove JBuffer.sliceFrom()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 07 Nov 2016 23:49:41 -0700 |
parents | 4afdf0f0c5bc |
children | 1ab2dd0a7db5 |
files | src/org/eclipse/jetty/http/HttpParser.java src/org/eclipse/jetty/io/JBuffer.java |
diffstat | 2 files changed, 15 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpParser.java Mon Nov 07 23:34:48 2016 -0700 +++ b/src/org/eclipse/jetty/http/HttpParser.java Mon Nov 07 23:49:41 2016 -0700 @@ -90,7 +90,9 @@ } private JBuffer sliceFromMark() { - JBuffer buf = _buffer.sliceFrom(_mark); + JBuffer buf = _buffer.duplicate(); + buf.position(_mark); + buf.limit(_buffer.position()-1); _mark = -1; return buf; }
--- a/src/org/eclipse/jetty/io/JBuffer.java Mon Nov 07 23:34:48 2016 -0700 +++ b/src/org/eclipse/jetty/io/JBuffer.java Mon Nov 07 23:49:41 2016 -0700 @@ -21,6 +21,18 @@ this.bb = bb; } + public int position() { + return bb.position(); + } + + public void position(int i) { + bb.position(i); + } + + public void limit(int i) { + bb.limit(i); + } + public byte[] array() { return bb.hasArray() ? bb.array() : null; } @@ -145,13 +157,6 @@ return n; } - public final JBuffer sliceFrom(int index) { - ByteBuffer dup = bb.duplicate(); - dup.position(index); - dup.limit(bb.position()-1); - return new JBuffer(dup); - } - public int readFrom(InputStream in,int max) throws IOException { ByteBuffer dup = bb.duplicate(); int put = bb.limit();