public class TransactionAwareBufferedWriter extends Writer
Writer that delays actually writing to or closing the
buffer if a transaction is active. If a transaction is detected on the call
to Writer.write(String) the parameter is buffered and passed on to the
underlying writer only when the transaction is committed.| Constructor and Description |
|---|
TransactionAwareBufferedWriter(Writer writer,
Runnable closeCallback)
Create a new instance with the underlying writer provided, and a callback
to execute on close.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
long |
getBufferSize()
Convenience method for clients to determine if there is any unflushed
data.
|
void |
write(char[] cbuf,
int off,
int len) |
public TransactionAwareBufferedWriter(Writer writer, Runnable closeCallback)
writer - actually writes to outputcloseCallback - callback to execute on closepublic long getBufferSize()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class WriterIOExceptionpublic void write(char[] cbuf,
int off,
int len)
throws IOException
write in class WriterIOExceptionCopyright © 2014 SpringSource. All rights reserved.