public class AbortablePrintWriter extends PrintWriter
PrintWriter
that adds the ability to abort creation
and an onClose hook
Experimental API - subject to change.
out
Constructor and Description |
---|
AbortablePrintWriter(PrintWriter pw)
Wrap a
PrintWriter instance. |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Abort creation of this output.
|
void |
close()
Closes this resource.
|
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(PrintWriter pw)
PrintWriter
instance.pw
- RuntimeException
- if there are reflection errors accessing the out
field in pwpublic void abort()
public void close()
AutoCloseable
close
in interface Closeable
close
in interface AutoCloseable
close
in class PrintWriter
protected void onClose(boolean aborted)
PrintWriter
is closed or aborted.aborted
- Copyright © 2018. All rights reserved.