40 |
class StreamInputStream extends DTPInputStream |
class StreamInputStream extends DTPInputStream |
41 |
{ |
{ |
42 |
|
|
43 |
StreamInputStream(DTP dtp, InputStream in) |
StreamInputStream(DTP dtp, InputStream in) |
44 |
{ |
{ |
45 |
super(dtp, in); |
super(dtp, in); |
46 |
} |
} |
47 |
|
|
48 |
public int read() |
public int read() throws IOException |
49 |
throws IOException |
{ |
50 |
{ |
if (transferComplete) |
51 |
if (transferComplete) |
return -1; |
52 |
return -1; |
int c = super.read(); |
53 |
int c = super.read(); |
if (c == -1) |
54 |
if (c==-1) |
close(); |
55 |
close(); |
return c; |
56 |
return c; |
} |
|
} |
|
57 |
|
|
58 |
public int read(byte[] buf) |
public int read(byte[]buf) throws IOException |
59 |
throws IOException |
{ |
60 |
{ |
return read(buf, 0, buf.length); |
61 |
return read(buf, 0, buf.length); |
} |
|
} |
|
62 |
|
|
63 |
public int read(byte[] buf, int off, int len) |
public int read(byte[]buf, int off, int len) throws IOException |
64 |
throws IOException |
{ |
65 |
{ |
if (transferComplete) |
66 |
if (transferComplete) |
return -1; |
67 |
return -1; |
int l = super.read(buf, off, len); |
68 |
int l = super.read(buf, off, len); |
if (l == -1) |
69 |
if (l==-1) |
close(); |
70 |
close(); |
return l; |
71 |
return l; |
} |
|
} |
|
72 |
|
|
73 |
} |
} |