public class ReversibleFileOperations extends Object implements AutoCloseable
commit(). All uncomitted operations will be reverted when try block is finalized. ie.:
try (ReversibleFileOperations reversibleFileOperations = new ReversibleFileOperations())
{
reversibleFileOperations.fileDelete(file1);
reversibleFileOperations.fileDelete(file2);
reversibleFileOperaions.commit()
} // exception will revert all not commited operations
| Constructor and Description |
|---|
ReversibleFileOperations() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
commit()
Commits all pending operations.
|
void |
fileDelete(File file)
Call this to perform deletion operation on file.
|
void |
removeOnRollback(File file)
Call this right after you created a file.
|
public void removeOnRollback(File file)
public void fileDelete(File file) throws IOException
IOExceptionpublic void commit()
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface AutoCloseableIOExceptionCopyright © 2002-2019 Atlassian. All Rights Reserved.