diff src/org/eclipse/jetty/server/HttpWriter.java @ 985:8fef34f665e7

remove HttpOutput
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 16 Oct 2016 23:47:23 -0600
parents 7b0fa315e835
children
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/HttpWriter.java	Sun Oct 16 23:11:15 2016 -0600
+++ b/src/org/eclipse/jetty/server/HttpWriter.java	Sun Oct 16 23:47:23 2016 -0600
@@ -27,7 +27,7 @@
 import org.eclipse.jetty.util.StringUtil;
 
 /** OutputWriter.
- * A writer that can wrap a {@link HttpOutput} stream and provide
+ * A writer that can wrap a {@link AbstractHttpConnection.Output} stream and provide
  * character encodings.
  *
  * The UTF-8 encoding is done by this class and no additional 
@@ -42,11 +42,11 @@
 	private static final int WRITE_ISO1 = 1;
 	private static final int WRITE_UTF8 = 2;
 	
-	private final HttpOutput _out;
+	private final AbstractHttpConnection.Output _out;
 	private int _writeMode;
 	private int _surrogate;
 
-	public HttpWriter(HttpOutput out)
+	public HttpWriter(AbstractHttpConnection.Output out)
 	{
 		_out = out;
 		_surrogate = 0; // AS lastUTF16CodePoint
@@ -108,11 +108,9 @@
 	@Override
 	public void write (char[] s,int offset, int length) throws IOException
 	{              
-		HttpOutput out = _out; 
-		
 		while (length > 0)
 		{  
-			out._bytes.reset();
+			_out._bytes.reset();
 			int chars = length>MAX_OUTPUT_CHARS?MAX_OUTPUT_CHARS:length;
 			
 			switch (_writeMode)
@@ -127,8 +125,8 @@
 
 				case WRITE_ISO1:
 				{
-					byte[] buffer=out._bytes.getBuf();
-					int bytes=out._bytes.getCount();
+					byte[] buffer = _out._bytes.getBuf();
+					int bytes = _out._bytes.getCount();
 					
 					if (chars>buffer.length-bytes)
 						chars=buffer.length-bytes;
@@ -139,15 +137,15 @@
 						buffer[bytes++]=(byte)(c<256?c:'?'); // ISO-1 and UTF-8 match for 0 - 255
 					}
 					if (bytes>=0)
-						out._bytes.setCount(bytes);
+						_out._bytes.setCount(bytes);
 
 					break;
 				}
 
 				case WRITE_UTF8:
 				{
-					byte[] buffer=out._bytes.getBuf();
-					int bytes=out._bytes.getCount();
+					byte[] buffer = _out._bytes.getBuf();
+					int bytes = _out._bytes.getCount();
 
 					if (bytes+chars>buffer.length)
 						chars=buffer.length-bytes;
@@ -270,14 +268,14 @@
 							}
 						}
 					}
-					out._bytes.setCount(bytes);
+					_out._bytes.setCount(bytes);
 					break;
 				}
 				default:
 					throw new IllegalStateException();
 			}
 			
-			out._bytes.writeTo(out);
+			_out._bytes.writeTo(_out);
 			length-=chars;
 			offset+=chars;
 		}