diff src/org/eclipse/jetty/io/AbstractBuffer.java @ 1010:2712133d5bce

simplify Buffer code
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 23 Oct 2016 22:23:50 -0600
parents 0e96ce3db20a
children f126d30e04a4
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/AbstractBuffer.java	Sun Oct 23 21:28:56 2016 -0600
+++ b/src/org/eclipse/jetty/io/AbstractBuffer.java	Sun Oct 23 22:23:50 2016 -0600
@@ -92,15 +92,6 @@
 			return new ByteArrayBuffer(asArray(), 0, length(), access);
 	}
 	
-	/*
-	 * @see org.eclipse.io.Buffer#asNonVolatile()
-	 */
-	public Buffer asNonVolatileBuffer()
-	{
-		if (!isVolatile()) return this;
-		return duplicate(_access);
-	}
-
 	public Buffer asImmutableBuffer()
 	{
 		if (isImmutable()) return this;
@@ -116,18 +107,6 @@
 		return new View(this, markIndex(), getIndex(), putIndex(), READONLY);
 	}
 
-	public Buffer asMutableBuffer()
-	{
-		if (!isImmutable()) return this;
-		
-		Buffer b=this.buffer();
-		if (b.isReadOnly())
-		{
-			return duplicate(READWRITE);
-		}
-		return new View(b, markIndex(), getIndex(), putIndex(), _access);
-	}
-
 	public Buffer buffer()
 	{
 		return this;
@@ -669,32 +648,6 @@
 	}
 
 	/* ------------------------------------------------------------ */
-	public void writeTo(OutputStream out)
-		throws IOException
-	{
-		byte[] array = array();
-		
-		if (array!=null)
-		{
-			out.write(array,getIndex(),length());
-		}
-		else
-		{
-			int len = this.length();
-			byte[] buf=new byte[len>1024?1024:len];
-			int offset=_get;
-			while (len>0)
-			{
-				int l=peek(offset,buf,0,len>buf.length?buf.length:len);
-				out.write(buf,0,l);
-				offset+=l;
-				len-=l;
-			}
-		} 
-		clear();
-	}
-	
-	/* ------------------------------------------------------------ */
 	public int readFrom(InputStream in,int max) throws IOException
 	{
 		byte[] array = array();