diff src/org/eclipse/jetty/io/nio/ChannelEndPoint.java @ 1038:b71ad168fe34

rename Buffer.length() to remaining()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 22:16:11 -0600
parents 921c25a05eaa
children a8c92b0a08ed
line wrap: on
line diff
--- 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();