org.springframework.batch.support.transaction
Class TransactionAwareBufferedWriter
java.lang.Object
java.io.Writer
org.springframework.batch.support.transaction.TransactionAwareBufferedWriter
- All Implemented Interfaces:
- java.io.Closeable, java.io.Flushable, java.lang.Appendable
public class TransactionAwareBufferedWriter
- extends java.io.Writer
Wrapper for a Writer that delays actually writing to 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.
- Author:
- Dave Syer
| Fields inherited from class java.io.Writer |
lock |
|
Method Summary |
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)
|
| Methods inherited from class java.io.Writer |
append, append, append, write, write, write, write |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransactionAwareBufferedWriter
public TransactionAwareBufferedWriter(java.io.Writer writer,
java.lang.String name)
- Parameters:
writer - actually writes to outputname - used to identify the transactional buffer used by this
instance
getBufferSize
public long getBufferSize()
- Convenience method for clients to determine if there is any unflushed
data.
- Returns:
- the current size of unflushed buffered data
close
public void close()
throws java.io.IOException
- Specified by:
close in interface java.io.Closeable- Specified by:
close in class java.io.Writer
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Specified by:
flush in interface java.io.Flushable- Specified by:
flush in class java.io.Writer
- Throws:
java.io.IOException
write
public void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
- Specified by:
write in class java.io.Writer
- Throws:
java.io.IOException
Copyright © 2009. All Rights Reserved.