4 package uk.ac.vamsas.client;
6 import java.io.DataOutputStream;
7 import java.io.IOException;
8 import java.io.OutputStream;
10 import org.apache.commons.logging.Log;
11 import org.apache.commons.logging.LogFactory;
17 public class AppDataOutputStream extends DataOutputStream {
18 private Log log = LogFactory.getLog(AppDataOutputStream.class);
19 private boolean isOpen=true;
23 public AppDataOutputStream(OutputStream out) {
28 * @see java.io.DataOutputStream#flush()
30 public void flush() throws IOException {
34 log.warn("flush() called on closed AppDataOutputStream");
37 * @see java.io.DataOutputStream#write(byte[], int, int)
39 public synchronized void write(byte[] b, int off, int len) throws IOException {
41 super.write(b, off, len);
43 log.debug("write(b,off,len) called on closed AppDataOutputStream");
44 throw new IOException("Attempt to write to closed AppDataOutputStream");
48 * @see java.io.DataOutputStream#write(int)
50 public synchronized void write(int b) throws IOException {
54 log.debug("write(b) called on closed AppDataOutputStream");
55 throw new IOException("Attempt to write to closed AppDataOutputStream");
59 * Sets an internal flag preventing further write operations
60 * to the AppData output stream and flushes any pending writes.
61 * @see java.io.FilterOutputStream#close()
63 public void close() throws IOException {
66 log.debug("AppDataOutputStream was closed.");
69 * @see java.io.FilterOutputStream#write(byte[])
71 public void write(byte[] b) throws IOException {
75 log.debug("write(b[]) called on closed AppDataOutputStream");
76 throw new IOException("Attempt to write to closed AppDataOutputStream");
80 * @return true if stream is still Open.
82 public boolean isOpen() {