28
29 import sun.rmi.runtime.Log;
30
31 /**
32 * The HttpInputStream class assists the HttpSendSocket and HttpReceiveSocket
33 * classes by filtering out the header for the message as well as any
34 * data after its proper content length.
35 */
36 class HttpInputStream extends FilterInputStream {
37
38 /** bytes remaining to be read from proper content of message */
39 protected int bytesLeft;
40
41 /** bytes remaining to be read at time of last mark */
42 protected int bytesLeftAtMark;
43
44 /**
45 * Create new filter on a given input stream.
46 * @param in the InputStream to filter from
47 */
48 public HttpInputStream(InputStream in) throws IOException
49 {
50 super(in);
51
52 if (in.markSupported())
53 in.mark(0); // prevent resetting back to old marks
54
55 // pull out header, looking for content length
56
57 DataInputStream dis = new DataInputStream(in);
58 String key = "Content-length:".toLowerCase();
59 boolean contentLengthFound = false;
60 String line;
61 do {
62 line = dis.readLine();
63
64 if (RMIMasterSocketFactory.proxyLog.isLoggable(Log.VERBOSE)) {
65 RMIMasterSocketFactory.proxyLog.log(Log.VERBOSE,
66 "received header line: \"" + line + "\"");
67 }
|
28
29 import sun.rmi.runtime.Log;
30
31 /**
32 * The HttpInputStream class assists the HttpSendSocket and HttpReceiveSocket
33 * classes by filtering out the header for the message as well as any
34 * data after its proper content length.
35 */
36 class HttpInputStream extends FilterInputStream {
37
38 /** bytes remaining to be read from proper content of message */
39 protected int bytesLeft;
40
41 /** bytes remaining to be read at time of last mark */
42 protected int bytesLeftAtMark;
43
44 /**
45 * Create new filter on a given input stream.
46 * @param in the InputStream to filter from
47 */
48 @SuppressWarnings("deprecation")
49 public HttpInputStream(InputStream in) throws IOException
50 {
51 super(in);
52
53 if (in.markSupported())
54 in.mark(0); // prevent resetting back to old marks
55
56 // pull out header, looking for content length
57
58 DataInputStream dis = new DataInputStream(in);
59 String key = "Content-length:".toLowerCase();
60 boolean contentLengthFound = false;
61 String line;
62 do {
63 line = dis.readLine();
64
65 if (RMIMasterSocketFactory.proxyLog.isLoggable(Log.VERBOSE)) {
66 RMIMasterSocketFactory.proxyLog.log(Log.VERBOSE,
67 "received header line: \"" + line + "\"");
68 }
|