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 Closeable
close
in interface AutoCloseable
close
in class Writer
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
public void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
IOException
Copyright © 2013 SpringSource. All rights reserved.