1 11 package org.eclipse.osgi.storagemanager; 12 13 import java.io.*; 14 15 24 public final class ManagedOutputStream extends FilterOutputStream { 27 static final int ST_OPEN = 0; 28 static final int ST_CLOSED = 1; 29 private String target; 30 private StorageManager manager; 31 private File outputFile; 32 private int state; 33 private ManagedOutputStream[] streamSet = null; 34 35 ManagedOutputStream(OutputStream out, StorageManager manager, String target, File outputFile) { 36 super(out); 37 this.manager = manager; 38 this.target = target; 39 this.outputFile = outputFile; 40 this.state = ST_OPEN; 41 } 42 43 51 public void close() throws IOException { 52 manager.closeOutputStream(this); 53 } 54 55 61 public void abort() { 62 manager.abortOutputStream(this); 63 } 64 65 OutputStream getOutputStream() { 66 return out; 67 } 68 69 String getTarget() { 70 return target; 71 } 72 73 File getOutputFile() { 74 return outputFile; 75 } 76 77 int getState() { 78 return state; 79 } 80 81 void setState(int state) { 82 this.state = state; 83 } 84 85 void setStreamSet(ManagedOutputStream[] set) { 86 streamSet = set; 87 } 88 89 ManagedOutputStream[] getStreamSet() { 90 return streamSet; 91 } 92 93 99 public void write(byte[] bytes, int off, int len) throws IOException { 100 out.write(bytes, off, len); 101 } 102 } 103 | Popular Tags |