40 |
abstract class DTPInputStream extends FilterInputStream |
abstract class DTPInputStream extends FilterInputStream |
41 |
{ |
{ |
42 |
|
|
43 |
DTP dtp; |
DTP dtp; |
44 |
boolean transferComplete; |
boolean transferComplete; |
45 |
|
|
46 |
/** |
/** |
47 |
* Constructor. |
* Constructor. |
48 |
* @param dtp the controlling data transfer process |
* @param dtp the controlling data transfer process |
49 |
* @param in the underlying socket stream |
* @param in the underlying socket stream |
50 |
*/ |
*/ |
51 |
DTPInputStream(DTP dtp, InputStream in) |
DTPInputStream(DTP dtp, InputStream in) |
52 |
{ |
{ |
53 |
super(in); |
super(in); |
54 |
this.dtp = dtp; |
this.dtp = dtp; |
55 |
transferComplete = false; |
transferComplete = false; |
56 |
} |
} |
57 |
|
|
58 |
/** |
/** |
59 |
* Marks this input stream complete. |
* Marks this input stream complete. |
60 |
* This is called by the DTP. |
* This is called by the DTP. |
61 |
*/ |
*/ |
62 |
void setTransferComplete(boolean flag) |
void setTransferComplete(boolean flag) |
63 |
{ |
{ |
64 |
transferComplete = flag; |
transferComplete = flag; |
65 |
} |
} |
66 |
|
|
67 |
public abstract int read() |
public abstract int read() throws IOException; |
|
throws IOException; |
|
68 |
|
|
69 |
public abstract int read(byte[] buf) |
public abstract int read(byte[]buf) throws IOException; |
|
throws IOException; |
|
70 |
|
|
71 |
public abstract int read(byte[] buf, int off, int len) |
public abstract int read(byte[]buf, int off, int len) throws IOException; |
|
throws IOException; |
|
72 |
|
|
73 |
/** |
/** |
74 |
* Notifies the controlling DTP that this stream has completed transfer. |
* Notifies the controlling DTP that this stream has completed transfer. |
75 |
*/ |
*/ |
76 |
public void close() |
public void close() throws IOException |
77 |
throws IOException |
{ |
78 |
{ |
dtp.transferComplete(); |
79 |
dtp.transferComplete(); |
} |
80 |
} |
|
|
|
|
81 |
} |
} |