1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.eclipse.jetty.server;
15
16 import java.io.IOException;
17
18 import javax.servlet.ServletInputStream;
19
20 import org.eclipse.jetty.http.HttpParser;
21 import org.eclipse.jetty.io.Buffer;
22
23 public class HttpInput extends ServletInputStream
24 {
25 protected final AbstractHttpConnection _connection;
26 protected final HttpParser _parser;
27
28
29 public HttpInput(AbstractHttpConnection connection)
30 {
31 _connection=connection;
32 _parser=(HttpParser)connection.getParser();
33 }
34
35
36
37
38
39 @Override
40 public int read() throws IOException
41 {
42 int c=-1;
43 Buffer content=_parser.blockForContent(_connection.getMaxIdleTime());
44 if (content!=null)
45 c= 0xff & content.get();
46 return c;
47 }
48
49
50
51
52
53 @Override
54 public int read(byte[] b, int off, int len) throws IOException
55 {
56 int l=-1;
57 Buffer content=_parser.blockForContent(_connection.getMaxIdleTime());
58 if (content!=null)
59 l= content.get(b, off, len);
60 return l;
61 }
62
63
64 @Override
65 public int available() throws IOException
66 {
67 return _parser.available();
68 }
69
70
71
72
73 }