comparison src/org/eclipse/jetty/server/AbstractHttpConnection.java @ 1046:a8c92b0a08ed

add JBuffer
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 07 Nov 2016 22:39:39 -0700
parents b71ad168fe34
children 2b769da7f67d
comparison
equal deleted inserted replaced
1045:48506d03e230 1046:a8c92b0a08ed
40 import org.eclipse.jetty.http.HttpVersions; 40 import org.eclipse.jetty.http.HttpVersions;
41 import org.eclipse.jetty.http.MimeTypes; 41 import org.eclipse.jetty.http.MimeTypes;
42 import org.eclipse.jetty.io.AbstractConnection; 42 import org.eclipse.jetty.io.AbstractConnection;
43 import org.eclipse.jetty.io.Buffer; 43 import org.eclipse.jetty.io.Buffer;
44 import org.eclipse.jetty.io.Buffers; 44 import org.eclipse.jetty.io.Buffers;
45 import org.eclipse.jetty.io.ByteArrayBuffer; 45 import org.eclipse.jetty.io.BufferUtil;
46 import org.eclipse.jetty.io.EndPoint; 46 import org.eclipse.jetty.io.EndPoint;
47 import org.eclipse.jetty.io.EofException; 47 import org.eclipse.jetty.io.EofException;
48 import org.eclipse.jetty.io.RuntimeIOException; 48 import org.eclipse.jetty.io.RuntimeIOException;
49 import org.eclipse.jetty.util.ByteArrayOutputStream2; 49 import org.eclipse.jetty.util.ByteArrayOutputStream2;
50 import org.eclipse.jetty.util.QuotedStringTokenizer; 50 import org.eclipse.jetty.util.QuotedStringTokenizer;
702 702
703 703
704 public final class Output extends ServletOutputStream 704 public final class Output extends ServletOutputStream
705 { 705 {
706 private boolean _closed; 706 private boolean _closed;
707 private ByteArrayBuffer _onebyte; 707 private Buffer _onebyte;
708 708
709 // These are held here for reuse by Writer 709 // These are held here for reuse by Writer
710 String _characterEncoding; 710 String _characterEncoding;
711 Writer _converter; 711 Writer _converter;
712 char[] _chars; 712 char[] _chars;
718 } 718 }
719 719
720 @Override 720 @Override
721 public final void write(byte[] b, int off, int len) throws IOException 721 public final void write(byte[] b, int off, int len) throws IOException
722 { 722 {
723 write(new ByteArrayBuffer(b,off,len)); 723 write(BufferUtil.wrap(b,off,len));
724 } 724 }
725 725
726 @Override 726 @Override
727 public final void write(byte[] b) throws IOException 727 public final void write(byte[] b) throws IOException
728 { 728 {
729 write(new ByteArrayBuffer(b)); 729 write(BufferUtil.wrap(b));
730 } 730 }
731 731
732 @Override 732 @Override
733 public final void write(int b) throws IOException 733 public final void write(int b) throws IOException
734 { 734 {
735 if (_onebyte==null) 735 if (_onebyte==null)
736 _onebyte = new ByteArrayBuffer(1); 736 _onebyte = BufferUtil.newBuffer(1);
737 else 737 else
738 _onebyte.clear(); 738 _onebyte.clear();
739 _onebyte.put((byte)b); 739 _onebyte.put((byte)b);
740 write(_onebyte); 740 write(_onebyte);
741 } 741 }