01: /*
02: * OutputMonitor.java February 2001
03: *
04: * Copyright (C) 2001, Niall Gallagher <niallg@users.sf.net>
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General
16: * Public License along with this library; if not, write to the
17: * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18: * Boston, MA 02111-1307 USA
19: */
20:
21: package simple.http;
22:
23: import java.io.OutputStream;
24:
25: /**
26: * It is important to note that once one of these methods are
27: * invoked by an <code>OutputStream</code> or an object monitoring
28: * an <code>OutputStream</code> then the <code>OutputStream</code>
29: * must not be used from that point on, that is, no more writing.
30: *
31: * @author Niall Gallagher
32: */
33: interface OutputMonitor {
34:
35: /**
36: * This will simply mark this stream as finished. This means that
37: * the <code>OutputStream</code> or object that was monitoring
38: * this <code>OutputStream</code> is now finished using it. The
39: * <code>OutputStream</code> 'out' must not be used by the object
40: * that made the invocation from this point on.
41: *
42: * @param out the <code>OutputStream</code> being monitored
43: */
44: public void notifyFinished(OutputStream out);
45:
46: /**
47: * This will notify that this <code>OutputStream</code> should be
48: * closed. It is the task of the <code>OutputMonitor</code> and
49: * not the object that is making the invocation to close the
50: * <code>OutputStream</code>, it may be close later.
51: *
52: * @param out the <code>OutputStream</code> being monitored
53: */
54: public void notifyClose(OutputStream out);
55:
56: /**
57: * This will notify the monitor that an error occured when writing
58: * to the <code>OutputStream</code>. The <code>OutputMonitor</code>
59: * will in its own time, mabye asynchronously, close the
60: * <code>OutputStream</code>, this is similar to close.
61: *
62: * @param out the <code>OutputStream</code> being monitored
63: */
64: public void notifyError(OutputStream out);
65: }
|