diff src/org/eclipse/jetty/http/HttpParser.java @ 1041:35e3c864d7a7

make View package local
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 04 Nov 2016 00:47:23 -0600
parents b71ad168fe34
children dd71a59fcf72
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpParser.java	Thu Nov 03 23:04:11 2016 -0600
+++ b/src/org/eclipse/jetty/http/HttpParser.java	Fri Nov 04 00:47:23 2016 -0600
@@ -21,10 +21,10 @@
 import java.io.IOException;
 
 import org.eclipse.jetty.io.Buffer;
+import org.eclipse.jetty.io.ByteArrayBuffer;
 import org.eclipse.jetty.io.BufferUtil;
 import org.eclipse.jetty.io.EndPoint;
 import org.eclipse.jetty.io.EofException;
-import org.eclipse.jetty.io.View;
 import org.eclipse.jetty.util.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -67,7 +67,7 @@
 	private int _responseStatus; // If >0 then we are parsing a response
 	private boolean _persistent;
 
-	private final View  _contentView = new View(); // View of the content in the buffer for {@link Input}
+	private Buffer _contentView = new ByteArrayBuffer(0); // View of the content in the buffer for {@link Input}
 	private int _state = STATE_START;
 	private byte _eol;
 	private int _length;
@@ -208,7 +208,7 @@
 						{
 							Buffer chunk = _buffer.get(_buffer.remaining());
 							_contentPosition += chunk.remaining();
-							_contentView.update(chunk);
+							_contentView = chunk;
 							_handler.content(); // May recurse here
 						}
 					}
@@ -733,7 +733,6 @@
 
 			// Handle _content
 			length=_buffer.remaining();
-			Buffer chunk;
 			last=_state;
 			while (_state > STATE_END && length > 0)
 			{
@@ -753,12 +752,14 @@
 				switch (_state)
 				{
 					case STATE_EOF_CONTENT:
-						chunk=_buffer.get(_buffer.remaining());
+					{
+						Buffer chunk = _buffer.get(_buffer.remaining());
 						_contentPosition += chunk.remaining();
-						_contentView.update(chunk);
+						_contentView = chunk;
 						_handler.content(); // May recurse here
 						// TODO adjust the _buffer to keep unconsumed content
 						return 1;
+					}
 
 					case STATE_CONTENT:
 					{
@@ -777,9 +778,9 @@
 							length=(int)remaining;
 						}
 
-						chunk=_buffer.get(length);
+						Buffer chunk = _buffer.get(length);
 						_contentPosition += chunk.remaining();
-						_contentView.update(chunk);
+						_contentView = chunk;
 						_handler.content(); // May recurse here
 
 						if(_contentPosition == _contentLength)
@@ -868,10 +869,10 @@
 						}
 						else if (length > remaining)
 							length=remaining;
-						chunk=_buffer.get(length);
+						Buffer chunk = _buffer.get(length);
 						_contentPosition += chunk.remaining();
 						_chunkPosition += chunk.remaining();
-						_contentView.update(chunk);
+						_contentView = chunk;
 						_handler.content(); // May recurse here
 						// TODO adjust the _buffer to keep unconsumed content
 						return 1;
@@ -1022,7 +1023,7 @@
 	 */
 	public int available() throws IOException
 	{
-		if (_contentView!=null && _contentView.remaining()>0)
+		if (_contentView.remaining()>0)
 			return _contentView.remaining();
 
 		if (_endp.isBlocking())
@@ -1031,7 +1032,7 @@
 		}
 
 		parseNext();
-		return _contentView==null?0:_contentView.remaining();
+		return _contentView.remaining();
 	}