diff src/org/eclipse/jetty/io/AbstractBuffer.java @ 1044:dd71a59fcf72

remove buffer marking
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 04 Nov 2016 02:26:54 -0600
parents ae1c92957739
children a8c92b0a08ed
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/AbstractBuffer.java	Fri Nov 04 01:10:12 2016 -0600
+++ b/src/org/eclipse/jetty/io/AbstractBuffer.java	Fri Nov 04 02:26:54 2016 -0600
@@ -46,7 +46,6 @@
 	protected int _hash;
 	protected int _hashGet;
 	protected int _hashPut;
-	protected int _mark;
 
 	/**
 	 * Constructor for BufferView
@@ -55,7 +54,6 @@
 	 */
 	protected AbstractBuffer(int access)
 	{
-		setMarkIndex(-1);
 		_access = access;
 	}
 
@@ -77,7 +75,6 @@
 
 	public void clear()
 	{
-		setMarkIndex(-1);
 		setGetIndex(0);
 		setPutIndex(0);
 	}
@@ -85,7 +82,7 @@
 	public void compact()
 	{
 		if (isReadOnly()) throw new IllegalStateException(__READONLY);
-		int s = markIndex() >= 0 ? markIndex() : getIndex();
+		int s = getIndex();
 		if (s > 0)
 		{
 			byte array[] = array();
@@ -97,7 +94,6 @@
 				else
 					poke(0, peek(s, length));
 			}
-			if (markIndex() > 0) setMarkIndex(markIndex() - s);
 			setGetIndex(getIndex() - s);
 			setPutIndex(putIndex() - s);
 		}
@@ -220,16 +216,6 @@
 		return _put - _get;
 	}
 
-	public void mark()
-	{
-		setMarkIndex(_get - 1);
-	}
-
-	public int markIndex()
-	{
-		return _mark;
-	}
-
 	public byte peek()
 	{
 		return peek(_get);
@@ -344,10 +330,9 @@
 		return _put;
 	}
 
-	public void rewind()
+	public final void rewind()
 	{
 		setGetIndex(0);
-		setMarkIndex(-1);
 	}
 
 	public void setGetIndex(int getIndex)
@@ -356,11 +341,6 @@
 		_hash=0;
 	}
 
-	public void setMarkIndex(int index)
-	{
-		_mark = index;
-	}
-
 	public void setPutIndex(int putIndex)
 	{
 		_put = putIndex;
@@ -379,17 +359,8 @@
 		return peek(getIndex(), remaining());
 	}
 
-	public Buffer sliceFromMark()
-	{
-		return sliceFromMark(getIndex() - markIndex() - 1);
-	}
-
-	public Buffer sliceFromMark(int length)
-	{
-		if (markIndex() < 0) return null;
-		Buffer view = peek(markIndex(), length);
-		setMarkIndex(-1);
-		return view;
+	public final Buffer sliceFrom(int index) {
+		return peek(index, getIndex()-index-1);
 	}
 
 	public int space()
@@ -404,8 +375,6 @@
 		buf.append(super.hashCode());
 		buf.append(",");
 		buf.append(this.buffer().hashCode());
-		buf.append(",m=");
-		buf.append(markIndex());
 		buf.append(",g=");
 		buf.append(getIndex());
 		buf.append(",p=");
@@ -413,15 +382,6 @@
 		buf.append(",c=");
 		buf.append(capacity());
 		buf.append("]={");
-		if (markIndex() >= 0)
-		{
-			for (int i = markIndex(); i < getIndex(); i++)
-			{
-				byte b =  peek(i);
-				TypeUtil.toHex(b,buf);
-			}
-			buf.append("}{");
-		}
 		int count = 0;
 		for (int i = getIndex(); i < putIndex(); i++)
 		{