KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > runtime > adaptor > StreamManagerOutputStream


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.runtime.adaptor;
12
13 import java.io.*;
14
15 /**
16  * Represents an <code>OutputStream</code> provided by FileManager
17  * @see StreamManager#getOutputStream(String)
18  * <p>
19  * Clients may not extend this class.
20  * </p>
21  * @since 3.1
22  */

23 public class StreamManagerOutputStream extends FilterOutputStream {
24     private String JavaDoc target;
25     private StreamManager manager;
26     private File outputFile;
27     private int state;
28     private StreamManagerOutputStream[] streamSet = null;
29
30     StreamManagerOutputStream(OutputStream out, StreamManager manager, String JavaDoc target, File outputFile, int state) {
31         super(out);
32         this.manager = manager;
33         this.target = target;
34         this.outputFile = outputFile;
35         this.state = state;
36     }
37
38     /**
39      * Instructs this output stream to be closed and file manager to
40      * be updated as appropriate.
41      *
42      * @see StreamManager#getOutputStream(String)
43      * @see StreamManager#getOutputStreamSet(String[])
44      */

45     public void close() throws IOException {
46         manager.closeOutputStream(this);
47     }
48
49     /**
50      * Instructs this output stream to be closed and the contents removed.
51      * @see StreamManager#getOutputStream(String)
52      * @see StreamManager#getOutputStreamSet(String[])
53      */

54     public void abort() {
55         manager.abortOutputStream(this);
56     }
57
58     OutputStream getOutputStream() {
59         return out;
60     }
61
62     String JavaDoc getTarget() {
63         return target;
64     }
65
66     File getOutputFile() {
67         return outputFile;
68     }
69
70     int getState() {
71         return state;
72     }
73
74     void setState(int state) {
75         this.state = state;
76     }
77
78     void setStreamSet(StreamManagerOutputStream[] set) {
79         streamSet = set;
80     }
81
82     StreamManagerOutputStream[] getStreamSet() {
83         return streamSet;
84     }
85 }
86
Popular Tags