40 |
abstract class DTPOutputStream extends FilterOutputStream |
abstract class DTPOutputStream extends FilterOutputStream |
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 out the socket output stream |
* @param out the socket output stream |
50 |
*/ |
*/ |
51 |
DTPOutputStream(DTP dtp, OutputStream out) |
DTPOutputStream(DTP dtp, OutputStream out) |
52 |
{ |
{ |
53 |
super(out); |
super(out); |
54 |
this.dtp = dtp; |
this.dtp = dtp; |
55 |
transferComplete = false; |
transferComplete = false; |
56 |
} |
} |
57 |
|
|
58 |
/** |
/** |
59 |
* Tells this stream whether transfer has completed or not. |
* Tells this stream whether transfer has completed or not. |
60 |
* @param flag true if the process has completed, false otherwise |
* @param flag true if the process has completed, false otherwise |
61 |
*/ |
*/ |
62 |
void setTransferComplete(boolean flag) |
void setTransferComplete(boolean flag) |
63 |
{ |
{ |
64 |
transferComplete = flag; |
transferComplete = flag; |
65 |
} |
} |
66 |
|
|
67 |
public abstract void write(int c) throws IOException; |
public abstract void write(int c) throws IOException; |
68 |
|
|
69 |
public abstract void write(byte[]b) throws IOException; |
public abstract void write(byte[]b) throws IOException; |
70 |
|
|
71 |
public abstract void write(byte[]b, int off, int len) throws IOException; |
public abstract void write(byte[]b, int off, int len) throws IOException; |
72 |
|
|
73 |
/** |
/** |
74 |
* Notifies the controlling DTP that this stream has been terminated. |
* Notifies the controlling DTP that this stream has been terminated. |
75 |
*/ |
*/ |
76 |
public void close() throws IOException |
public void close() throws IOException |
77 |
{ |
{ |
78 |
dtp.transferComplete(); |
dtp.transferComplete(); |
79 |
} |
} |
80 |
|
|
81 |
} |
} |