changeset 1038:b71ad168fe34

rename Buffer.length() to remaining()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 22:16:11 -0600
parents 3c4c7cc7904f
children a7319f14ba1e
files src/org/eclipse/jetty/http/AbstractGenerator.java src/org/eclipse/jetty/http/HttpGenerator.java 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/ByteArrayBuffer.java src/org/eclipse/jetty/io/nio/ChannelEndPoint.java src/org/eclipse/jetty/io/nio/DirectNIOBuffer.java src/org/eclipse/jetty/io/nio/SslConnection.java src/org/eclipse/jetty/server/AbstractHttpConnection.java
diffstat 10 files changed, 104 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/http/AbstractGenerator.java
--- a/src/org/eclipse/jetty/http/AbstractGenerator.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/http/AbstractGenerator.java	Thu Nov 03 22:16:11 2016 -0600
@@ -235,7 +235,7 @@
 		}
 		else
 		{
-			_contentWritten+=_buffer.length();
+			_contentWritten+=_buffer.remaining();
 			if (_head)
 				_buffer.clear();
 		}
@@ -245,12 +245,12 @@
 	{
 		if (_buffer != null && _buffer.space()==0)
 		{
-			if (_buffer.length()==0 && !_buffer.isImmutable())
+			if (_buffer.remaining()==0 && !_buffer.isImmutable())
 				_buffer.compact();
 			return _buffer.space()==0;
 		}
 
-		return _content!=null && _content.length()>0;
+		return _content!=null && _content.remaining()>0;
 	}
 
 	public final boolean isWritten()
@@ -296,11 +296,11 @@
 		long end=now+maxIdleTime;
 		Buffer content = _content;
 		Buffer buffer = _buffer;
-		if (content!=null && content.length()>0 || buffer!=null && buffer.length()>0 || isBufferFull())
+		if (content!=null && content.remaining()>0 || buffer!=null && buffer.remaining()>0 || isBufferFull())
 		{
 			flushBuffer();
 
-			while (now<end && (content!=null && content.length()>0 ||buffer!=null && buffer.length()>0) && _endp.isOpen()&& !_endp.isOutputShutdown())
+			while (now<end && (content!=null && content.remaining()>0 ||buffer!=null && buffer.remaining()>0) && _endp.isOpen()&& !_endp.isOutputShutdown())
 			{
 				blockForOutput(end-now);
 				now=System.currentTimeMillis();
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/http/HttpGenerator.java
--- a/src/org/eclipse/jetty/http/HttpGenerator.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/http/HttpGenerator.java	Thu Nov 03 22:16:11 2016 -0600
@@ -145,26 +145,26 @@
 		_last = last;
 
 		// Handle any unfinished business?
-		if (_content!=null && _content.length()>0 || _bufferChunked)
+		if (_content!=null && _content.remaining()>0 || _bufferChunked)
 		{
 			if (_endp.isOutputShutdown())
 				throw new EofException();
 			flushBuffer();
-			if (_content != null && _content.length()>0)
+			if (_content != null && _content.remaining()>0)
 			{
 				if (_bufferChunked)
 				{
-					Buffer nc = _buffers.getBuffer(_content.length()+CHUNK_SPACE+content.length());
+					Buffer nc = _buffers.getBuffer(_content.remaining()+CHUNK_SPACE+content.remaining());
 					nc.put(_content);
 					nc.put(HttpTokens.CRLF);
-					BufferUtil.putHexInt(nc, content.length());
+					BufferUtil.putHexInt(nc, content.remaining());
 					nc.put(HttpTokens.CRLF);
 					nc.put(content);
 					content=nc;
 				}
 				else
 				{
-					Buffer nc = _buffers.getBuffer(_content.length()+content.length());
+					Buffer nc = _buffers.getBuffer(_content.remaining()+content.remaining());
 					nc.put(_content);
 					nc.put(content);
 					content=nc;
@@ -173,7 +173,7 @@
 		}
 
 		_content = content;
-		_contentWritten += content.length();
+		_contentWritten += content.remaining();
 
 		// Handle the _content
 		if (_head)
@@ -181,7 +181,7 @@
 			content.clear();
 			_content=null;
 		}
-		else if (_endp != null && (_buffer==null || _buffer.length()==0) && _content.length() > 0 && (_last || isCommitted() && _content.length()>1024))
+		else if (_endp != null && (_buffer==null || _buffer.remaining()==0) && _content.remaining() > 0 && (_last || isCommitted() && _content.remaining()>1024))
 		{
 			_bypass = true;
 		}
@@ -194,7 +194,7 @@
 			// Copy _content to buffer;
 			int len=_buffer.put(_content);
 			_content.skip(len);
-			if (_content.length() == 0)
+			if (_content.remaining() == 0)
 				_content = null;
 		}
 	}
@@ -215,10 +215,10 @@
 
 		// Handle any unfinished business?
 		Buffer content = _content;
-		if (content != null && content.length()>0 || _bufferChunked)
+		if (content != null && content.remaining()>0 || _bufferChunked)
 		{
 			flushBuffer();
-			if (content != null && content.length()>0 || _bufferChunked)
+			if (content != null && content.remaining()>0 || _bufferChunked)
 				throw new IllegalStateException("FULL");
 		}
 
@@ -226,7 +226,7 @@
 		if (_buffer == null)
 			_buffer = _buffers.getBuffer();
 
-		_contentWritten-=_buffer.length();
+		_contentWritten-=_buffer.remaining();
 
 		// Handle the _content
 		if (_head)
@@ -263,7 +263,7 @@
 		try
 		{
 			// nasty semi busy flush!
-			while(_header.length()>0)
+			while(_header.remaining()>0)
 			{
 				int len = _endp.flush(_header);
 				if (len<0)
@@ -793,7 +793,7 @@
 
 								// Special case handling for small left over buffer from
 								// an addContent that caused a buffer flush.
-								if (_content != null && _content.length() < _buffer.space() && _state != STATE_FLUSHING)
+								if (_content != null && _content.remaining() < _buffer.space() && _state != STATE_FLUSHING)
 								{
 									_buffer.put(_content);
 									_content.clear();
@@ -803,7 +803,7 @@
 						}
 
 						// Are we completely finished for now?
-						if (!_needCRLF && !_needEOC && (_content==null || _content.length()==0))
+						if (!_needCRLF && !_needEOC && (_content==null || _content.remaining()==0))
 						{
 							if (_state == STATE_FLUSHING)
 								_state = STATE_END;
@@ -837,9 +837,9 @@
 
 	private int flushMask()
 	{
-		return  ((_header != null && _header.length() > 0)?4:0)
-		| ((_buffer != null && _buffer.length() > 0)?2:0)
-		| ((_bypass && _content != null && _content.length() > 0)?1:0);
+		return  ((_header != null && _header.remaining() > 0)?4:0)
+		| ((_buffer != null && _buffer.remaining() > 0)?2:0)
+		| ((_bypass && _content != null && _content.remaining() > 0)?1:0);
 	}
 
 	private void prepareBuffers()
@@ -848,21 +848,21 @@
 		if (!_bufferChunked)
 		{
 			// Refill buffer if possible
-			if (!_bypass && _content != null && _content.length() > 0 && _buffer != null && _buffer.space() > 0)
+			if (!_bypass && _content != null && _content.remaining() > 0 && _buffer != null && _buffer.space() > 0)
 			{
 				int len = _buffer.put(_content);
 				_content.skip(len);
-				if (_content.length() == 0)
+				if (_content.remaining() == 0)
 					_content = null;
 			}
 
 			// Chunk buffer if need be
 			if (_contentLength == HttpTokens.CHUNKED_CONTENT)
 			{
-				if (_bypass && (_buffer==null||_buffer.length()==0) && _content!=null)
+				if (_bypass && (_buffer==null||_buffer.remaining()==0) && _content!=null)
 				{
 					// this is a bypass write
-					int size = _content.length();
+					int size = _content.remaining();
 					_bufferChunked = true;
 
 					if (_header == null)
@@ -871,7 +871,7 @@
 					// if we need CRLF add this to header
 					if (_needCRLF)
 					{
-						if (_header.length() > 0) throw new IllegalStateException("EOC");
+						if (_header.remaining() > 0) throw new IllegalStateException("EOC");
 						_header.put(HttpTokens.CRLF);
 						_needCRLF = false;
 					}
@@ -884,7 +884,7 @@
 				}
 				else if (_buffer!=null)
 				{
-					int size = _buffer.length();
+					int size = _buffer.remaining();
 					if (size > 0)
 					{
 						// Prepare a chunk!
@@ -914,7 +914,7 @@
 
 							if (_needCRLF)
 							{
-								if (_header.length() > 0) throw new IllegalStateException("EOC");
+								if (_header.remaining() > 0) throw new IllegalStateException("EOC");
 								_header.put(HttpTokens.CRLF);
 								_needCRLF = false;
 							}
@@ -931,7 +931,7 @@
 				}
 
 				// If we need EOC and everything written
-				if (_needEOC && (_content == null || _content.length() == 0))
+				if (_needEOC && (_content == null || _content.remaining() == 0))
 				{
 					if (_header == null && _buffer == null)
 						_header = _buffers.getHeader();
@@ -975,7 +975,7 @@
 			}
 		}
 
-		if (_content != null && _content.length() == 0)
+		if (_content != null && _content.remaining() == 0)
 			_content = null;
 
 	}
@@ -989,8 +989,8 @@
 		return String.format("%s{s=%d,h=%d,b=%d,c=%d}",
 				getClass().getSimpleName(),
 				_state,
-				header == null ? -1 : header.length(),
-				buffer == null ? -1 : buffer.length(),
-				content == null ? -1 : content.length());
+				header == null ? -1 : header.remaining(),
+				buffer == null ? -1 : buffer.remaining(),
+				content == null ? -1 : content.remaining());
 	}
 }
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/http/HttpParser.java
--- a/src/org/eclipse/jetty/http/HttpParser.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/http/HttpParser.java	Thu Nov 03 22:16:11 2016 -0600
@@ -144,7 +144,7 @@
 		boolean progress = parseNext() > 0;
 
 		// continue parsing
-		while (!isComplete() && _buffer!=null && _buffer.length()>0 && !_contentView.hasRemaining())
+		while (!isComplete() && _buffer!=null && _buffer.remaining()>0 && !_contentView.hasRemaining())
 		{
 			progress |= parseNext()>0;
 		}
@@ -177,7 +177,7 @@
 				return 1;
 			}
 
-			int length = _buffer.length();
+			int length = _buffer.remaining();
 
 			// Fill buffer if we can
 			if (length == 0)
@@ -187,7 +187,7 @@
 				try
 				{
 					filled=fill();
-					LOG.debug("filled {}/{}",filled,_buffer.length());
+					LOG.debug("filled {}/{}",filled,_buffer.remaining());
 				}
 				catch(IOException e)
 				{
@@ -204,10 +204,10 @@
 					// do we have content to deliver?
 					if (_state>STATE_END)
 					{
-						if (_buffer.length()>0 && !_headResponse)
+						if (_buffer.remaining()>0 && !_headResponse)
 						{
-							Buffer chunk = _buffer.get(_buffer.length());
-							_contentPosition += chunk.length();
+							Buffer chunk = _buffer.get(_buffer.remaining());
+							_contentPosition += chunk.remaining();
 							_contentView.update(chunk);
 							_handler.content(); // May recurse here
 						}
@@ -241,7 +241,7 @@
 
 					return -1;
 				}
-				length=_buffer.length();
+				length=_buffer.remaining();
 			}
 
 
@@ -579,7 +579,7 @@
 										{
 											_length = _cached.length();
 											_buffer.setGetIndex(_buffer.markIndex()+_length);
-											length = _buffer.length();
+											length = _buffer.remaining();
 										}
 									}
 								}
@@ -732,7 +732,7 @@
 			// ==========================
 
 			// Handle _content
-			length=_buffer.length();
+			length=_buffer.remaining();
 			Buffer chunk;
 			last=_state;
 			while (_state > STATE_END && length > 0)
@@ -746,15 +746,15 @@
 				if (_eol == HttpTokens.CARRIAGE_RETURN && _buffer.peek() == HttpTokens.LINE_FEED)
 				{
 					_eol=_buffer.get();
-					length=_buffer.length();
+					length=_buffer.remaining();
 					continue;
 				}
 				_eol=0;
 				switch (_state)
 				{
 					case STATE_EOF_CONTENT:
-						chunk=_buffer.get(_buffer.length());
-						_contentPosition += chunk.length();
+						chunk=_buffer.get(_buffer.remaining());
+						_contentPosition += chunk.remaining();
 						_contentView.update(chunk);
 						_handler.content(); // May recurse here
 						// TODO adjust the _buffer to keep unconsumed content
@@ -778,7 +778,7 @@
 						}
 
 						chunk=_buffer.get(length);
-						_contentPosition += chunk.length();
+						_contentPosition += chunk.remaining();
 						_contentView.update(chunk);
 						_handler.content(); // May recurse here
 
@@ -869,8 +869,8 @@
 						else if (length > remaining)
 							length=remaining;
 						chunk=_buffer.get(length);
-						_contentPosition += chunk.length();
-						_chunkPosition += chunk.length();
+						_contentPosition += chunk.remaining();
+						_chunkPosition += chunk.remaining();
 						_contentView.update(chunk);
 						_handler.content(); // May recurse here
 						// TODO adjust the _buffer to keep unconsumed content
@@ -880,7 +880,7 @@
 					case STATE_SEEKING_EOF:
 					{                        
 						// Close if there is more data than CRLF
-						if (_buffer.length()>2)
+						if (_buffer.remaining()>2)
 						{
 							_state = STATE_END;
 							_endp.close();
@@ -888,7 +888,7 @@
 						else  
 						{
 							// or if the data is not white space
-							while (_buffer.length()>0)
+							while (_buffer.remaining()>0)
 								if (!Character.isWhitespace(_buffer.get()))
 								{
 									_state = STATE_END;
@@ -902,7 +902,7 @@
 					}
 				}
 
-				length=_buffer.length();
+				length=_buffer.remaining();
 			}
 
 			return progress;
@@ -929,11 +929,11 @@
 		if (_state>STATE_END && _buffer==_header && !_header.hasRemaining() && _body.hasRemaining())
 		{
 			_buffer = _body;
-			return _buffer.length();
+			return _buffer.remaining();
 		}
 
 		// Shall we switch to a body buffer?
-		if (_buffer==_header && _state>STATE_END && _header.length()==0 && ((_contentLength-_contentPosition)>_header.capacity()))
+		if (_buffer==_header && _state>STATE_END && _header.remaining()==0 && ((_contentLength-_contentPosition)>_header.capacity()))
 		{
 			_buffer = _body;
 		}
@@ -978,7 +978,7 @@
 
 	public Buffer blockForContent(long maxIdleTime) throws IOException
 	{
-		if (_contentView.length()>0)
+		if (_contentView.remaining()>0)
 			return _contentView;
 
 		if (_state <= STATE_END || _state==STATE_SEEKING_EOF)
@@ -989,7 +989,7 @@
 			parseNext();
 
 			// parse until some progress is made (or IOException thrown for timeout)
-			while(_contentView.length() == 0 && !(_state==STATE_END||_state==STATE_SEEKING_EOF) && _endp.isOpen())
+			while(_contentView.remaining() == 0 && !(_state==STATE_END||_state==STATE_SEEKING_EOF) && _endp.isOpen())
 			{
 				if (!_endp.isBlocking())
 				{
@@ -1013,7 +1013,7 @@
 			throw e;
 		}
 
-		return _contentView.length()>0 ? _contentView : null;
+		return _contentView.remaining()>0 ? _contentView : null;
 	}
 
 	/* ------------------------------------------------------------ */
@@ -1022,8 +1022,8 @@
 	 */
 	public int available() throws IOException
 	{
-		if (_contentView!=null && _contentView.length()>0)
-			return _contentView.length();
+		if (_contentView!=null && _contentView.remaining()>0)
+			return _contentView.remaining();
 
 		if (_endp.isBlocking())
 		{
@@ -1031,7 +1031,7 @@
 		}
 
 		parseNext();
-		return _contentView==null?0:_contentView.length();
+		return _contentView==null?0:_contentView.remaining();
 	}
 
 
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/io/AbstractBuffer.java
--- a/src/org/eclipse/jetty/io/AbstractBuffer.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/io/AbstractBuffer.java	Thu Nov 03 22:16:11 2016 -0600
@@ -63,12 +63,12 @@
 
 	public byte[] asArray()
 	{
-		byte[] bytes = new byte[length()];
+		byte[] bytes = new byte[remaining()];
 		byte[] array = array();
 		if (array != null)
 			System.arraycopy(array, getIndex(), bytes, 0, bytes.length);
 		else
-			peek(getIndex(), bytes, 0, length());
+			peek(getIndex(), bytes, 0, remaining());
 		return bytes;
 	}
 
@@ -116,7 +116,7 @@
 		Buffer b = (Buffer) obj;
 
 		// reject different lengths
-		if (b.length() != length()) return false;
+		if (b.remaining() != remaining()) return false;
 
 		// reject AbstractBuffer with different hash value
 		if (_hash != 0 && obj instanceof AbstractBuffer)
@@ -145,7 +145,7 @@
 	public int get(byte[] b, int offset, int length)
 	{
 		int gi = getIndex();
-		int l=length();
+		int l=remaining();
 		if (l==0)
 			return -1;
 		
@@ -222,7 +222,7 @@
 		return _access <= READONLY;
 	}
 
-	public int length()
+	public int remaining()
 	{
 		return _put - _get;
 	}
@@ -270,7 +270,7 @@
 	{
 		_hash=0;
 		
-		int length=src.length();
+		int length=src.remaining();
 		if (index + length > capacity())
 		{
 			length=capacity()-index;
@@ -396,14 +396,14 @@
 
 	public int skip(int n)
 	{
-		if (length() < n) n = length();
+		if (remaining() < n) n = remaining();
 		setGetIndex(getIndex() + n);
 		return n;
 	}
 
 	public Buffer slice()
 	{
-		return peek(getIndex(), length());
+		return peek(getIndex(), remaining());
 	}
 
 	public Buffer sliceFromMark()
@@ -474,10 +474,10 @@
 		if (isImmutable())
 		{
 			if (_string == null) 
-				_string = new String(asArray(), 0, length());
+				_string = new String(asArray(), 0, remaining());
 			return _string;
 		}
-		return new String(asArray(), 0, length());
+		return new String(asArray(), 0, remaining());
 */
 		return toString("ISO-8859-1");
 	}
@@ -494,14 +494,14 @@
 		{
 			byte[] bytes=array();
 			if (bytes!=null)
-				return new String(bytes,getIndex(),length(),charset);
-			return new String(asArray(), 0, length(),charset);
+				return new String(bytes,getIndex(),remaining(),charset);
+			return new String(asArray(), 0, remaining(),charset);
 			
 		}
 		catch(Exception e)
 		{
 			LOG.warn("",e);
-			return new String(asArray(), 0, length());
+			return new String(asArray(), 0, remaining());
 		}
 	}
 
@@ -512,13 +512,13 @@
 		{
 			byte[] bytes=array();
 			if (bytes!=null)
-				return new String(bytes,getIndex(),length(),charset);
-			return new String(asArray(), 0, length(),charset);
+				return new String(bytes,getIndex(),remaining(),charset);
+			return new String(asArray(), 0, remaining(),charset);
 		}
 		catch(Exception e)
 		{
 			LOG.warn("",e);
-			return new String(asArray(), 0, length());
+			return new String(asArray(), 0, remaining());
 		}
 	}
 
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/io/Buffer.java
--- a/src/org/eclipse/jetty/io/Buffer.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/io/Buffer.java	Thu Nov 03 22:16:11 2016 -0600
@@ -143,7 +143,7 @@
 	 * The number of bytes from the getIndex to the putIndex
 	 * @return an <code>int</code> == putIndex()-getIndex()
 	 */
-	int length();
+	int remaining();
 	
 	/**
 	 * Set the mark to the current getIndex.
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/io/ByteArrayBuffer.java
--- a/src/org/eclipse/jetty/io/ByteArrayBuffer.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/io/ByteArrayBuffer.java	Thu Nov 03 22:16:11 2016 -0600
@@ -118,7 +118,7 @@
 		Buffer b = (Buffer) obj;
 		
 		// reject different lengths
-		if (b.length() != length()) 
+		if (b.remaining() != remaining()) 
 			return false;
 
 		// reject AbstractBuffer with different hash value
@@ -220,7 +220,7 @@
 			throw new IllegalArgumentException("index<0: " + index + "<0");
 		*/
 		
-		int length=src.length();
+		int length=src.remaining();
 		if (index + length > capacity())
 		{
 			length=capacity()-index;
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/io/nio/ChannelEndPoint.java
--- a/src/org/eclipse/jetty/io/nio/ChannelEndPoint.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/ChannelEndPoint.java	Thu Nov 03 22:16:11 2016 -0600
@@ -249,7 +249,7 @@
 		}
 		else if (buffer.array()!=null)
 		{
-			ByteBuffer b = ByteBuffer.wrap(buffer.array(), buffer.getIndex(), buffer.length());
+			ByteBuffer b = ByteBuffer.wrap(buffer.array(), buffer.getIndex(), buffer.remaining());
 			len=_channel.write(b);
 			if (len>0)
 				buffer.skip(len);
@@ -270,26 +270,26 @@
 		Buffer buf1 = buffer==null?null:buffer.buffer();
 
 		if (_channel instanceof GatheringByteChannel &&
-			header!=null && header.length()!=0 && buf0 instanceof NIOBuffer &&
-			buffer!=null && buffer.length()!=0 && buf1 instanceof NIOBuffer)
+			header!=null && header.remaining()!=0 && buf0 instanceof NIOBuffer &&
+			buffer!=null && buffer.remaining()!=0 && buf1 instanceof NIOBuffer)
 		{
 			length = gatheringFlush(header,((NIOBuffer)buf0).getByteBuffer(),buffer,((NIOBuffer)buf1).getByteBuffer());
 		}
 		else
 		{
 			// flush header
-			if (header!=null && header.length()>0)
+			if (header!=null && header.remaining()>0)
 				length=flush(header);
 
 			// flush buffer
-			if ((header==null || header.length()==0) &&
-				 buffer!=null && buffer.length()>0)
+			if ((header==null || header.remaining()==0) &&
+				 buffer!=null && buffer.remaining()>0)
 				length+=flush(buffer);
 
 			// flush trailer
-			if ((header==null || header.length()==0) &&
-				(buffer==null || buffer.length()==0) &&
-				 trailer!=null && trailer.length()>0)
+			if ((header==null || header.remaining()==0) &&
+				(buffer==null || buffer.remaining()==0) &&
+				 trailer!=null && trailer.remaining()>0)
 				length+=flush(trailer);
 		}
 
@@ -316,7 +316,7 @@
 			// do the gathering write.
 			length=(int)((GatheringByteChannel)_channel).write(_gather2);
 
-			int hl=header.length();
+			int hl=header.remaining();
 			if (length>hl)
 			{
 				header.clear();
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/io/nio/DirectNIOBuffer.java
--- a/src/org/eclipse/jetty/io/nio/DirectNIOBuffer.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/DirectNIOBuffer.java	Thu Nov 03 22:16:11 2016 -0600
@@ -121,7 +121,7 @@
 		byte[] array=src.array();
 		if (array!=null)
 		{
-			return poke(index,array,src.getIndex(),src.length());
+			return poke(index,array,src.getIndex(),src.remaining());
 		}
 		else
 		{
@@ -136,7 +136,7 @@
 					_buf.position(index);
 					int space = _buf.remaining();
 					
-					int length=src.length();
+					int length=src.remaining();
 					if (length>space)    
 						length=space;
 					
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/io/nio/SslConnection.java
--- a/src/org/eclipse/jetty/io/nio/SslConnection.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SslConnection.java	Thu Nov 03 22:16:11 2016 -0600
@@ -138,9 +138,9 @@
 			if (--_allocations==0)
 			{
 				if (_buffers!=null &&
-					_inbound.length()==0 &&
-					_outbound.length()==0 &&
-					_unwrapBuf.length()==0)
+					_inbound.remaining()==0 &&
+					_outbound.remaining()==0 &&
+					_unwrapBuf.remaining()==0)
 				{
 					_inbound=null;
 					_outbound=null;
@@ -279,7 +279,7 @@
 				}
 				finally
 				{
-					_logger.debug("{} {} {} filled={}/{} flushed={}/{}",_session,this,_engine.getHandshakeStatus(),filled,_inbound.length(),flushed,_outbound.length());
+					_logger.debug("{} {} {} filled={}/{} flushed={}/{}",_session,this,_engine.getHandshakeStatus(),filled,_inbound.remaining(),flushed,_outbound.remaining());
 				}
 
 				// handle the current hand share status
@@ -605,10 +605,10 @@
 
 		public int fill(Buffer buffer) throws IOException
 		{
-			int size=buffer.length();
+			int size=buffer.remaining();
 			process(buffer, null);
 
-			int filled=buffer.length()-size;
+			int filled=buffer.remaining()-size;
 
 			if (filled==0 && isInputShutdown())
 				return -1;
@@ -617,9 +617,9 @@
 
 		public int flush(Buffer buffer) throws IOException
 		{
-			int size = buffer.length();
+			int size = buffer.remaining();
 			process(null, buffer);
-			return size-buffer.length();
+			return size-buffer.remaining();
 		}
 
 		public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
@@ -737,9 +737,9 @@
 			Buffer inbound = _inbound;
 			Buffer outbound = _outbound;
 			Buffer unwrap = _unwrapBuf;
-			int i = inbound == null? -1 : inbound.length();
-			int o = outbound == null ? -1 : outbound.length();
-			int u = unwrap == null ? -1 : unwrap.length();
+			int i = inbound == null? -1 : inbound.remaining();
+			int o = outbound == null ? -1 : outbound.remaining();
+			int u = unwrap == null ? -1 : unwrap.remaining();
 			return String.format("SSL %s i/o/u=%d/%d/%d ishut=%b oshut=%b {%s}",
 					_engine.getHandshakeStatus(),
 					i, o, u,
diff -r 3c4c7cc7904f -r b71ad168fe34 src/org/eclipse/jetty/server/AbstractHttpConnection.java
--- a/src/org/eclipse/jetty/server/AbstractHttpConnection.java	Thu Nov 03 21:54:34 2016 -0600
+++ b/src/org/eclipse/jetty/server/AbstractHttpConnection.java	Thu Nov 03 22:16:11 2016 -0600
@@ -174,7 +174,7 @@
 		if (_expect100Continue)
 		{
 			// is content missing?
-			if (_parser._header.length()<2)
+			if (_parser._header.remaining()<2)
 			{
 				if (_generator.isCommitted())
 					throw new IllegalStateException("Committed before 100 Continues");
@@ -771,7 +771,7 @@
 				commitResponse(HttpGenerator.MORE);
 	
 			// Block until our buffer is free
-			while (buffer.length() > 0 && _generator.isOpen())
+			while (buffer.remaining() > 0 && _generator.isOpen())
 			{
 				_generator.blockForOutput(getMaxIdleTime());
 			}