equal
deleted
inserted
replaced
39 * bytes may be drained to consume them (by calling drain() ). |
39 * bytes may be drained to consume them (by calling drain() ). |
40 * |
40 * |
41 * isEOF() returns true, when all expected bytes have been read |
41 * isEOF() returns true, when all expected bytes have been read |
42 */ |
42 */ |
43 abstract class LeftOverInputStream extends FilterInputStream { |
43 abstract class LeftOverInputStream extends FilterInputStream { |
44 ExchangeImpl t; |
44 final ExchangeImpl t; |
45 ServerImpl server; |
45 final ServerImpl server; |
46 protected boolean closed = false; |
46 protected boolean closed = false; |
47 protected boolean eof = false; |
47 protected boolean eof = false; |
48 byte[] one = new byte [1]; |
48 byte[] one = new byte [1]; |
49 |
49 |
50 public LeftOverInputStream (ExchangeImpl t, InputStream src) { |
50 public LeftOverInputStream (ExchangeImpl t, InputStream src) { |
107 */ |
107 */ |
108 public boolean drain (long l) throws IOException { |
108 public boolean drain (long l) throws IOException { |
109 int bufSize = 2048; |
109 int bufSize = 2048; |
110 byte[] db = new byte [bufSize]; |
110 byte[] db = new byte [bufSize]; |
111 while (l > 0) { |
111 while (l > 0) { |
|
112 if (server.isFinishing()) { |
|
113 break; |
|
114 } |
112 long len = readImpl (db, 0, bufSize); |
115 long len = readImpl (db, 0, bufSize); |
113 if (len == -1) { |
116 if (len == -1) { |
114 eof = true; |
117 eof = true; |
115 return true; |
118 return true; |
116 } else { |
119 } else { |