comparison src/org/eclipse/jetty/server/HttpInput.java @ 980:bd26bd9320e2

simplify HttpParser
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 16 Oct 2016 21:01:26 -0600
parents 5ee36654b383
children
comparison
equal deleted inserted replaced
979:c8cd3e96db5f 980:bd26bd9320e2
24 24
25 import org.eclipse.jetty.http.HttpParser; 25 import org.eclipse.jetty.http.HttpParser;
26 import org.eclipse.jetty.io.Buffer; 26 import org.eclipse.jetty.io.Buffer;
27 import org.eclipse.jetty.io.EofException; 27 import org.eclipse.jetty.io.EofException;
28 28
29 public class HttpInput extends ServletInputStream 29 public final class HttpInput extends ServletInputStream
30 { 30 {
31 protected final AbstractHttpConnection _connection; 31 protected final AbstractHttpConnection _connection;
32 protected final HttpParser _parser; 32 protected final HttpParser _parser;
33 33
34 public HttpInput(AbstractHttpConnection connection) 34 public HttpInput(AbstractHttpConnection connection)
54 * @see java.io.InputStream#read(byte[], int, int) 54 * @see java.io.InputStream#read(byte[], int, int)
55 */ 55 */
56 @Override 56 @Override
57 public int read(byte[] b, int off, int len) throws IOException 57 public int read(byte[] b, int off, int len) throws IOException
58 { 58 {
59 int l=-1; 59 int l = -1;
60 Buffer content=_parser.blockForContent(_connection.getMaxIdleTime()); 60 Buffer content = _parser.blockForContent(_connection.getMaxIdleTime());
61 if (content!=null) 61 if (content!=null)
62 l= content.get(b, off, len); 62 l = content.get(b, off, len);
63 else if (_connection.isEarlyEOF()) 63 else if (_connection.isEarlyEOF())
64 throw new EofException("early EOF"); 64 throw new EofException("early EOF");
65 return l; 65 return l;
66 } 66 }
67 67
68 /* ------------------------------------------------------------ */
69 @Override 68 @Override
70 public int available() throws IOException 69 public int available() throws IOException
71 { 70 {
72 return _parser.available(); 71 return _parser.available();
73 } 72 }