diff src/org/eclipse/jetty/io/AbstractBuffer.java @ 1041:35e3c864d7a7

make View package local
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 04 Nov 2016 00:47:23 -0600
parents 3e4949834f3e
children a62193321d6a
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/AbstractBuffer.java	Thu Nov 03 23:04:11 2016 -0600
+++ b/src/org/eclipse/jetty/io/AbstractBuffer.java	Fri Nov 04 00:47:23 2016 -0600
@@ -47,7 +47,6 @@
 	protected int _hashGet;
 	protected int _hashPut;
 	protected int _mark;
-	protected View _view;
 
 	/**
 	 * Constructor for BufferView
@@ -243,20 +242,10 @@
 
 	private Buffer peek(int index, int length)
 	{
-		if (_view == null)
-		{
-			_view = new View(this, -1, index, index + length, isReadOnly() ? READONLY : READWRITE);
-		}
-		else
-		{
-			_view.update(this.buffer());
-			_view.setMarkIndex(-1);
-			_view.setGetIndex(0);
-			_view.setPutIndex(index + length);
-			_view.setGetIndex(index);
-			
-		}
-		return _view;
+		Buffer view = duplicate();
+		view.setPutIndex(index + length);
+		view.setGetIndex(index);
+		return view;
 	}
 
 	@Override
@@ -544,4 +533,8 @@
 			return total; 
 		}
 	}
+
+	public final Buffer duplicate() {
+		return new View(this);
+	}
 }