changeset 1037:3c4c7cc7904f

rename Buffer.hasContent() to hasRemaining()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 21:54:34 -0600
parents b87f97f6418a
children b71ad168fe34
files src/org/eclipse/jetty/http/HttpParser.java src/org/eclipse/jetty/io/AbstractBuffer.java src/org/eclipse/jetty/io/Buffer.java src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java src/org/eclipse/jetty/io/nio/SslConnection.java
diffstat 5 files changed, 25 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpParser.java	Thu Nov 03 21:42:41 2016 -0600
+++ b/src/org/eclipse/jetty/http/HttpParser.java	Thu Nov 03 21:54:34 2016 -0600
@@ -144,7 +144,7 @@
 		boolean progress = parseNext() > 0;
 
 		// continue parsing
-		while (!isComplete() && _buffer!=null && _buffer.length()>0 && !_contentView.hasContent())
+		while (!isComplete() && _buffer!=null && _buffer.length()>0 && !_contentView.hasRemaining())
 		{
 			progress |= parseNext()>0;
 		}
@@ -177,7 +177,7 @@
 				return 1;
 			}
 
-			int length=_buffer.length();
+			int length = _buffer.length();
 
 			// Fill buffer if we can
 			if (length == 0)
@@ -532,7 +532,7 @@
 
 									_contentPosition=0;
 									_eol=ch;
-									if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasContent() && _buffer.peek()==HttpTokens.LINE_FEED)
+									if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED)
 										_eol=_buffer.get();
 
 									// We convert _contentLength to an int for this switch statement because
@@ -816,7 +816,7 @@
 
 							if (_chunkLength == 0)
 							{
-								if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasContent() && _buffer.peek()==HttpTokens.LINE_FEED)
+								if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED)
 									_eol=_buffer.get();
 								_state = _persistent?STATE_END:STATE_SEEKING_EOF;
 								_handler.messageComplete(_contentPosition);
@@ -846,7 +846,7 @@
 							_eol=ch;
 							if (_chunkLength == 0)
 							{
-								if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasContent() && _buffer.peek()==HttpTokens.LINE_FEED)
+								if (_eol==HttpTokens.CARRIAGE_RETURN && _buffer.hasRemaining() && _buffer.peek()==HttpTokens.LINE_FEED)
 									_eol=_buffer.get();
 								_state = _persistent?STATE_END:STATE_SEEKING_EOF;
 								_handler.messageComplete(_contentPosition);
@@ -926,7 +926,7 @@
 			_buffer = _header;
 
 		// Is there unconsumed content in body buffer
-		if (_state>STATE_END && _buffer==_header && !_header.hasContent() && _body.hasContent())
+		if (_state>STATE_END && _buffer==_header && !_header.hasRemaining() && _body.hasRemaining())
 		{
 			_buffer = _body;
 			return _buffer.length();
--- a/src/org/eclipse/jetty/io/AbstractBuffer.java	Thu Nov 03 21:42:41 2016 -0600
+++ b/src/org/eclipse/jetty/io/AbstractBuffer.java	Thu Nov 03 21:54:34 2016 -0600
@@ -171,7 +171,7 @@
 		return _get;
 	}
 
-	public boolean hasContent()
+	public boolean hasRemaining()
 	{
 		return _put > _get;
 	}
--- a/src/org/eclipse/jetty/io/Buffer.java	Thu Nov 03 21:42:41 2016 -0600
+++ b/src/org/eclipse/jetty/io/Buffer.java	Thu Nov 03 21:54:34 2016 -0600
@@ -122,7 +122,7 @@
 	/**
 	 * @return true of putIndex > getIndex
 	 */
-	boolean hasContent();
+	boolean hasRemaining();
 	
 	/**
 	 * 
--- a/src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java	Thu Nov 03 21:42:41 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java	Thu Nov 03 21:54:34 2016 -0600
@@ -169,7 +169,7 @@
 		int l = super.flush(header, buffer, trailer);
 
 		// If there was something to write and it wasn't written, then we are not writable.
-		if (l==0 && ( header!=null && header.hasContent() || buffer!=null && buffer.hasContent() || trailer!=null && trailer.hasContent()))
+		if (l==0 && ( header!=null && header.hasRemaining() || buffer!=null && buffer.hasRemaining() || trailer!=null && trailer.hasRemaining()))
 		{
 			synchronized (this)
 			{   
@@ -191,7 +191,7 @@
 		int l = super.flush(buffer);
 
 		// If there was something to write and it wasn't written, then we are not writable.
-		if (l==0 && buffer!=null && buffer.hasContent())
+		if (l==0 && buffer!=null && buffer.hasRemaining())
 		{
 			synchronized (this)
 			{   
--- a/src/org/eclipse/jetty/io/nio/SslConnection.java	Thu Nov 03 21:42:41 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SslConnection.java	Thu Nov 03 21:54:34 2016 -0600
@@ -230,7 +230,7 @@
 				boolean progress=process(null,toFlush);
 
 				// if we received any data,
-				if (_unwrapBuf!=null && _unwrapBuf.hasContent())
+				if (_unwrapBuf!=null && _unwrapBuf.hasRemaining())
 				{
 					// transfer from temp buffer to fill buffer
 					_unwrapBuf.skip(toFill.put(_unwrapBuf));
@@ -241,7 +241,7 @@
 					return progress;
 			}
 			// Else if there is some temporary data
-			else if (_unwrapBuf!=null && _unwrapBuf.hasContent())
+			else if (_unwrapBuf!=null && _unwrapBuf.hasRemaining())
 			{
 				// transfer from temp buffer to fill buffer
 				_unwrapBuf.skip(toFill.put(_unwrapBuf));
@@ -269,7 +269,7 @@
 						progress = true;
 
 					// flush any output data
-					if (_outbound.hasContent() && (flushed=_endp.flush(_outbound))>0)
+					if (_outbound.hasRemaining() && (flushed=_endp.flush(_outbound))>0)
 						progress = true;
 				}
 				catch (IOException e)
@@ -291,11 +291,11 @@
 					case NOT_HANDSHAKING:
 					{
 						// Try unwrapping some application data
-						if (toFill.space()>0 && _inbound.hasContent() && unwrap(toFill))
+						if (toFill.space()>0 && _inbound.hasRemaining() && unwrap(toFill))
 							progress=true;
 
 						// Try wrapping some application data
-						if (toFlush.hasContent() && _outbound.space()>0 && wrap(toFlush))
+						if (toFlush.hasRemaining() && _outbound.space()>0 && wrap(toFlush))
 							progress=true;
 					}
 					break;
@@ -328,7 +328,7 @@
 						// The SSL needs to receive some handshake data from the other side
 						if (_handshook && !_allowRenegotiate)
 							_endp.close();
-						else if (!_inbound.hasContent()&&filled==-1)
+						else if (!_inbound.hasRemaining()&&filled==-1)
 						{
 							// No more input coming
 							_endp.shutdownInput();
@@ -340,10 +340,10 @@
 				}
 
 				// pass on ishut/oshut state
-				if (_endp.isOpen() && _endp.isInputShutdown() && !_inbound.hasContent())
+				if (_endp.isOpen() && _endp.isInputShutdown() && !_inbound.hasRemaining())
 					closeInbound();
 
-				if (_endp.isOpen() && _engine.isOutboundDone() && !_outbound.hasContent())
+				if (_endp.isOpen() && _engine.isOutboundDone() && !_outbound.hasRemaining())
 					_endp.shutdownOutput();
 
 				// remember if any progress has been made
@@ -351,7 +351,7 @@
 			}
 
 			// If we are reading into the temp buffer and it has some content, then we should be dispatched.
-			if (toFill==_unwrapBuf && _unwrapBuf.hasContent() && !_connection.isSuspended())
+			if (toFill==_unwrapBuf && _unwrapBuf.hasRemaining() && !_connection.isSuspended())
 				_aEndp.dispatch();
 		}
 		finally
@@ -450,7 +450,7 @@
 
 	private synchronized boolean unwrap(final Buffer buffer) throws IOException
 	{
-		if (!_inbound.hasContent())
+		if (!_inbound.hasRemaining())
 			return false;
 
 		ByteBuffer bbuf=extractByteBuffer(buffer);
@@ -592,8 +592,8 @@
 			synchronized (SslConnection.this)
 			{
 				return _endp.isInputShutdown() &&
-				!(_unwrapBuf!=null&&_unwrapBuf.hasContent()) &&
-				!(_inbound!=null&&_inbound.hasContent());
+				!(_unwrapBuf!=null&&_unwrapBuf.hasRemaining()) &&
+				!(_inbound!=null&&_inbound.hasRemaining());
 			}
 		}
 
@@ -624,11 +624,11 @@
 
 		public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
 		{
-			if (header!=null && header.hasContent())
+			if (header!=null && header.hasRemaining())
 				return flush(header);
-			if (buffer!=null && buffer.hasContent())
+			if (buffer!=null && buffer.hasRemaining())
 				return flush(buffer);
-			if (trailer!=null && trailer.hasContent())
+			if (trailer!=null && trailer.hasRemaining())
 				return flush(trailer);
 			return 0;
 		}