Package rife.tools
Class FileBuilder
java.lang.Object
rife.tools.FileBuilder
Directory and file structure builder, using a fluent API and lambdas
 to convey the hierarchical structure of on the filesystem in code.
- Since:
- 1.5.19
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionFileBuilder(File file) Constructs a newFileBuilderobject with the specified file.FileBuilder(File file, FileAction action) Constructs a newFileBuilderobject with the specified file and performs an action on it.FileBuilder(Path path) Constructs a newFileBuilderobject with the specified path.FileBuilder(Path path, FileAction action) Constructs a newFileBuilderobject with the specified path and performs an action on it.
- 
Method SummaryModifier and TypeMethodDescriptionCopies the specified source file to the file of thisFileBuilder.delete()Deletes the file object of thisFileBuilder.Moves the specified source file to the file of thisFileBuilder.perms(int mode) Sets the permissions for the file represented by thisFileBuilderusing the specified Posix mode.perms(Set<PosixFilePermission> permissions) Sets the permissions for the file represented by thisFileBuilderusing the specified permissions.touch()Touches the file of thisFileBuilder.Writes the specified text to the file of thisFileBuilder.
- 
Constructor Details- 
FileBuilderConstructs a newFileBuilderobject with the specified file.- Parameters:
- file- The file object to perform operations on
- Since:
- 1.5.19
 
- 
FileBuilderConstructs a newFileBuilderobject with the specified path.- Parameters:
- path- The path to perform operations on
- Since:
- 1.5.19
 
- 
FileBuilderConstructs a newFileBuilderobject with the specified file and performs an action on it.- Parameters:
- file- The file object to perform operations on
- action- The action to be performed on the file object
- Throws:
- IOException- if an error occurs while executing the action.
- Since:
- 1.5.19
 
- 
FileBuilderConstructs a newFileBuilderobject with the specified path and performs an action on it.- Parameters:
- path- The path to perform operations on
- action- The action to be performed on the file object
- Throws:
- IOException- if an error occurs while executing the action.
- Since:
- 1.5.19
 
 
- 
- 
Method Details- 
copyCopies the specified source file to the file of thisFileBuilder.- Parameters:
- source- The source file to be copied
- Returns:
- this FileBuilderobject
- Throws:
- IOException- if an error occurs while copying the file.
- Since:
- 1.5.19
 
- 
moveMoves the specified source file to the file of thisFileBuilder.- Parameters:
- source- The source file to be moved
- Returns:
- this FileBuilderobject
- Throws:
- IOException- if an error occurs while moving the file.
- Since:
- 1.5.19
 
- 
writeWrites the specified text to the file of thisFileBuilder.- Parameters:
- text- The text to be written to the file
- Returns:
- this FileBuilderobject
- Throws:
- IOException- if an error occurs while moving the file.
- Since:
- 1.5.19
 
- 
touchTouches the file of thisFileBuilder.If the file does not exist, it creates a new file. If the file exists, it updates the last access and last modification time of the file. - Returns:
- this FileBuilderobject
- Throws:
- IOException- if an error occurs while touching the file.
- Since:
- 1.5.19
 
- 
deleteDeletes the file object of thisFileBuilder.- Returns:
- this FileBuilderobject
- Throws:
- IOException- if an error occurs while touching the file.
- Since:
- 1.5.19
 
- 
permsSets the permissions for the file represented by thisFileBuilderusing the specified Posix mode.- Parameters:
- mode- The mode to use for setting the permissions.
- Returns:
- this FileBuilderinstance.
- Throws:
- IOException- if an error occurs while setting the permissions.
- Since:
- 1.5.19
 
- 
permsSets the permissions for the file represented by thisFileBuilderusing the specified permissions.- Parameters:
- permissions- The permissions to use for setting the permissions.
- Returns:
- this FileBuilderinstance.
- Throws:
- IOException- if an error occurs while setting the permissions.
- Since:
- 1.5.19
 
 
-