public class AbortablePrintWriter
extends java.io.PrintWriter
PrintWriter
that adds the ability to abort creation
and an onClose hook
Experimental API - subject to change.
Constructor and Description |
---|
AbortablePrintWriter(java.io.PrintWriter pw)
Wrap a
PrintWriter instance. |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Abort creation of this output.
|
void |
close() |
protected void |
onClose(boolean aborted)
Called exactly once when this
PrintWriter is closed or aborted. |
append, append, append, checkError, clearError, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
public AbortablePrintWriter(java.io.PrintWriter pw)
PrintWriter
instance.pw
- java.lang.RuntimeException
- if there are reflection errors accessing the out
field in pwpublic void abort()
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.PrintWriter
protected void onClose(boolean aborted)
PrintWriter
is closed or aborted.aborted
-