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
IOException
public void commit() throws IOException
IOException
public void close() throws IOException
close
in interface AutoCloseable
IOException
Copyright © 2002-2024 Atlassian. All Rights Reserved.