diff src/org/eclipse/jetty/http/AbstractGenerator.java @ 1046:a8c92b0a08ed

add JBuffer
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 07 Nov 2016 22:39:39 -0700
parents a7319f14ba1e
children 2b769da7f67d
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/AbstractGenerator.java	Sun Nov 06 14:54:43 2016 -0700
+++ b/src/org/eclipse/jetty/http/AbstractGenerator.java	Mon Nov 07 22:39:39 2016 -0700
@@ -22,7 +22,7 @@
 
 import org.eclipse.jetty.io.Buffer;
 import org.eclipse.jetty.io.Buffers;
-import org.eclipse.jetty.io.ByteArrayBuffer;
+import org.eclipse.jetty.io.BufferUtil;
 import org.eclipse.jetty.io.EndPoint;
 import org.eclipse.jetty.io.EofException;
 import org.slf4j.Logger;
@@ -214,7 +214,7 @@
 			// TODO don't hard code
 			if (len>1024)
 				len=1024;
-			_reason = new ByteArrayBuffer(len);
+			_reason = BufferUtil.newBuffer(len);
 			for (int i=0;i<len;i++)
 			{
 				char ch = reason.charAt(i);
@@ -334,12 +334,12 @@
 			if (content != null)
 			{
 				completeHeader(null, false);
-				addContent(new ByteArrayBuffer(content), LAST);
+				addContent(BufferUtil.wrap(content), LAST);
 			}
 			else if (code>=400)
 			{
 				completeHeader(null, false);
-				addContent(new ByteArrayBuffer("Error: "+(reason==null?(""+code):reason)), LAST);
+				addContent(BufferUtil.wrap("Error: "+(reason==null?(""+code):reason)), LAST);
 			}
 			else
 			{