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