Class UndoableWriterWrapper

java.lang.Object
java.io.Writer
de.hybris.bootstrap.xml.UndoableWriterWrapper
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class UndoableWriterWrapper extends Writer
Writer wrapper implementation which allows to write a certain amount of (string) data and removing it afterwards from the output.

 UndoableWriterWrapper wr = new UndoableWriterWrapper(actualWriter);

 // start undoable writing
 wr.markSavePoint();
 try
 {
        // ... write into wrapper ...

        // finally store changes
        wr.commitSavePoint();
 }
 catch (Exception e)
 {
        // discard any changes
        wr.restoreSavePoint();
 }