Debian Codegraph @

src/main/java/org/freehep/util/io/NoCloseOutputStream.java

raw
1 // Copyright 2001, FreeHEP.
2 package org.freehep.util.io;
3
4 import java.io.BufferedOutputStream;
5 import java.io.IOException;
6 import java.io.OutputStream;
7
8 /**
9 * The NoCloseOutputStream ignores the close so that one can keep writing to the
10 * underlying stream.
11 *
12 * @author Mark Donszelmann
13 * @version $Id: NoCloseOutputStream.java 8584 2006-08-10 23:06:37Z duns $
14 */
15 public class NoCloseOutputStream extends BufferedOutputStream {
16
17 /**
18 * Creates a No Close output stream.
19 *
20 * @param stream stream to write to
21 */
22 public NoCloseOutputStream(OutputStream stream) {
23 super(stream);
24 }
25
26 /**
27 * Creates a No Close output stream.
28 *
29 * @param stream stream to write to
30 * @param size buffer size
31 */
32 public NoCloseOutputStream(OutputStream stream, int size) {
33 super(stream, size);
34 }
35
36 public void close() throws IOException {
37 flush();
38 }
39
40 /**
41 * Closes the stream (the close method is ignored).
42 *
43 * @throws IOException if the close fails
44 */
45 public void realClose() throws IOException {
46 super.close();
47 }
48 }