Mercurial Hosting > luan
diff src/org/eclipse/jetty/server/HttpInput.java @ 972:5ee36654b383
simplify AbstractHttpConnection
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 15 Oct 2016 22:42:05 -0600 |
parents | 3428c60d7cfc |
children | bd26bd9320e2 |
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/HttpInput.java Fri Oct 14 13:06:06 2016 -0600 +++ b/src/org/eclipse/jetty/server/HttpInput.java Sat Oct 15 22:42:05 2016 -0600 @@ -28,48 +28,47 @@ public class HttpInput extends ServletInputStream { - protected final AbstractHttpConnection _connection; - protected final HttpParser _parser; + protected final AbstractHttpConnection _connection; + protected final HttpParser _parser; - /* ------------------------------------------------------------ */ - public HttpInput(AbstractHttpConnection connection) - { - _connection=connection; - _parser=(HttpParser)connection.getParser(); - } - - /* ------------------------------------------------------------ */ - /* - * @see java.io.InputStream#read() - */ - @Override - public int read() throws IOException - { - byte[] bytes = new byte[1]; - int read = read(bytes, 0, 1); - return read < 0 ? -1 : 0xff & bytes[0]; - } - - /* ------------------------------------------------------------ */ - /* - * @see java.io.InputStream#read(byte[], int, int) - */ - @Override - public int read(byte[] b, int off, int len) throws IOException - { - int l=-1; - Buffer content=_parser.blockForContent(_connection.getMaxIdleTime()); - if (content!=null) - l= content.get(b, off, len); - else if (_connection.isEarlyEOF()) - throw new EofException("early EOF"); - return l; - } + public HttpInput(AbstractHttpConnection connection) + { + _connection = connection; + _parser = connection._parser; + } + + /* ------------------------------------------------------------ */ + /* + * @see java.io.InputStream#read() + */ + @Override + public int read() throws IOException + { + byte[] bytes = new byte[1]; + int read = read(bytes, 0, 1); + return read < 0 ? -1 : 0xff & bytes[0]; + } + + /* ------------------------------------------------------------ */ + /* + * @see java.io.InputStream#read(byte[], int, int) + */ + @Override + public int read(byte[] b, int off, int len) throws IOException + { + int l=-1; + Buffer content=_parser.blockForContent(_connection.getMaxIdleTime()); + if (content!=null) + l= content.get(b, off, len); + else if (_connection.isEarlyEOF()) + throw new EofException("early EOF"); + return l; + } - /* ------------------------------------------------------------ */ - @Override - public int available() throws IOException - { - return _parser.available(); - } + /* ------------------------------------------------------------ */ + @Override + public int available() throws IOException + { + return _parser.available(); + } }