Package org.terracotta.utilities.io
Class FilesSupport.PathHolder
- java.lang.Object
-
- org.terracotta.utilities.io.FilesSupport.PathHolder
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Enclosing class:
- FilesSupport
private static class FilesSupport.PathHolder extends java.lang.Object implements java.lang.AutoCloseableSupport class to open or lock a file for file operation impact assessment.Although this class has "support" for opening a directory, there appears to be no reliable means in Java of opening a directory and observing the impact on other file operations.
-
-
Constructor Summary
Constructors Modifier Constructor Description privatePathHolder(java.nio.file.Path path, boolean lock)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes and unlocks the file.private voidholdDirectory(java.nio.file.Path dir)private voidholdFile(java.nio.file.Path file)Holds open a file for read.private voidlockFile(java.nio.file.Path file)Holds a lock on a file.voidstart()Open or lock the file and return.
-
-
-
Method Detail
-
holdFile
private void holdFile(java.nio.file.Path file)
Holds open a file for read.- Parameters:
file- the file path to hold open
-
lockFile
private void lockFile(java.nio.file.Path file)
Holds a lock on a file.- Parameters:
file- the file path to lock
-
holdDirectory
private void holdDirectory(java.nio.file.Path dir)
-
start
public void start()
Open or lock the file and return. The file remains opened or locked untilclose()is called.
-
close
public void close()
Closes and unlocks the file.- Specified by:
closein interfacejava.lang.AutoCloseable
-
-