comparison src/org/eclipse/jetty/server/AbstractHttpConnection.java @ 1048:2b769da7f67d

remove Buffer
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 07 Nov 2016 23:15:42 -0700
parents a8c92b0a08ed
children 013939bfc9e8
comparison
equal deleted inserted replaced
1047:1accf965d51a 1048:2b769da7f67d
38 import org.eclipse.jetty.http.HttpStatus; 38 import org.eclipse.jetty.http.HttpStatus;
39 import org.eclipse.jetty.http.HttpURI; 39 import org.eclipse.jetty.http.HttpURI;
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.JBuffer;
44 import org.eclipse.jetty.io.Buffers; 44 import org.eclipse.jetty.io.Buffers;
45 import org.eclipse.jetty.io.BufferUtil; 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;
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 Buffer _onebyte; 707 private JBuffer _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;
738 _onebyte.clear(); 738 _onebyte.clear();
739 _onebyte.put((byte)b); 739 _onebyte.put((byte)b);
740 write(_onebyte); 740 write(_onebyte);
741 } 741 }
742 742
743 private void write(Buffer buffer) throws IOException 743 private void write(JBuffer buffer) throws IOException
744 { 744 {
745 if (_closed) 745 if (_closed)
746 throw new IOException("Closed"); 746 throw new IOException("Closed");
747 if (!_generator.isOpen()) 747 if (!_generator.isOpen())
748 throw new EofException(); 748 throw new EofException();
832 throw new IllegalStateException("!empty"); 832 throw new IllegalStateException("!empty");
833 833
834 try 834 try
835 { 835 {
836 int max = _generator.prepareUncheckedAddContent(); 836 int max = _generator.prepareUncheckedAddContent();
837 Buffer buffer = _generator.getUncheckedBuffer(); 837 JBuffer buffer = _generator.getUncheckedBuffer();
838 838
839 int len = buffer.readFrom(in,max); 839 int len = buffer.readFrom(in,max);
840 840
841 while (len>=0) 841 while (len>=0)
842 { 842 {
878 */ 878 */
879 @Override 879 @Override
880 public int read(byte[] b, int off, int len) throws IOException 880 public int read(byte[] b, int off, int len) throws IOException
881 { 881 {
882 int l = -1; 882 int l = -1;
883 Buffer content = _parser.blockForContent(getMaxIdleTime()); 883 JBuffer content = _parser.blockForContent(getMaxIdleTime());
884 if (content!=null) 884 if (content!=null)
885 l = content.get(b, off, len); 885 l = content.get(b, off, len);
886 else if (_earlyEOF) 886 else if (_earlyEOF)
887 throw new EofException("early EOF"); 887 throw new EofException("early EOF");
888 return l; 888 return l;