Mercurial Hosting > luan
changeset 1051:1ab2dd0a7db5
remove JBuffer.get(int)
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 08 Nov 2016 00:18:45 -0700 |
parents | 5ef954fad97b |
children | 4a2489f1d5fe |
files | src/org/eclipse/jetty/http/HttpParser.java src/org/eclipse/jetty/io/JBuffer.java |
diffstat | 2 files changed, 14 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpParser.java Mon Nov 07 23:49:41 2016 -0700 +++ b/src/org/eclipse/jetty/http/HttpParser.java Tue Nov 08 00:18:45 2016 -0700 @@ -114,6 +114,15 @@ } } + public JBuffer getBuffer(int length) { + JBuffer dup = _buffer.duplicate(); + int end = _buffer.position() + length; + dup.limit(end); + _buffer.position(end); + return dup; + } + + public long getContentLength() { return _contentLength; @@ -236,7 +245,7 @@ { if (_buffer.remaining()>0 && !_headResponse) { - JBuffer chunk = _buffer.get(_buffer.remaining()); + JBuffer chunk = getBuffer(_buffer.remaining()); _contentPosition += chunk.remaining(); _contentView = chunk; _handler.content(); // May recurse here @@ -783,7 +792,7 @@ { case STATE_EOF_CONTENT: { - JBuffer chunk = _buffer.get(_buffer.remaining()); + JBuffer chunk = getBuffer(_buffer.remaining()); _contentPosition += chunk.remaining(); _contentView = chunk; _handler.content(); // May recurse here @@ -808,7 +817,7 @@ length=(int)remaining; } - JBuffer chunk = _buffer.get(length); + JBuffer chunk = getBuffer(length); _contentPosition += chunk.remaining(); _contentView = chunk; _handler.content(); // May recurse here @@ -899,7 +908,7 @@ } else if (length > remaining) length=remaining; - JBuffer chunk = _buffer.get(length); + JBuffer chunk = getBuffer(length); _contentPosition += chunk.remaining(); _chunkPosition += chunk.remaining(); _contentView = chunk;
--- a/src/org/eclipse/jetty/io/JBuffer.java Mon Nov 07 23:49:41 2016 -0700 +++ b/src/org/eclipse/jetty/io/JBuffer.java Tue Nov 08 00:18:45 2016 -0700 @@ -90,14 +90,6 @@ } - public JBuffer get(int length) { - ByteBuffer dup = bb.duplicate(); - int end = bb.position()+length; - dup.limit(end); - bb.position(end); - return new JBuffer(dup); - } - public int get(byte[] b, int offset, int length) { int remaining = bb.remaining(); if( remaining == 0 ) @@ -151,10 +143,9 @@ bb.limit(putIndex); } - public int skip(int n) { + public void skip(int n) { if (remaining() < n) n = remaining(); bb.position(bb.position() + n); - return n; } public int readFrom(InputStream in,int max) throws IOException {