Package io.roastedroot.zerofs
Class FileFactory
java.lang.Object
io.roastedroot.zerofs.FileFactory
Factory for creating new files and copying files. One piece of the file store implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate final classprivate final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HeapDiskprivate final FileTimeSourceprivate final AtomicIntegerprivate final Supplier<RegularFile> -
Constructor Summary
ConstructorsConstructorDescriptionFileFactory(HeapDisk disk, FileTimeSource fileTimeSource) Creates a new file factory using the given disk for regular files and the given time source. -
Method Summary
Modifier and TypeMethodDescriptioncopyWithoutContent(File file) Creates and returns a copy of the given file.Creates a new directory.(package private) RegularFileCreates a new regular file.createRootDirectory(Name name) Creates a new root directory with the given name.(package private) SymbolicLinkcreateSymbolicLink(ZeroFsPath target) Creates a new symbolic link referencing the given target path.Returns a supplier that creates directories.private intReturns a supplier that creates regular files.symbolicLinkCreator(ZeroFsPath target) Returns a supplier that creates a symbolic links to the given path.
-
Field Details
-
idGenerator
-
disk
-
fileTimeSource
-
directorySupplier
-
regularFileSupplier
-
-
Constructor Details
-
FileFactory
Creates a new file factory using the given disk for regular files and the given time source.
-
-
Method Details
-
nextFileId
private int nextFileId() -
createDirectory
Creates a new directory. -
createRootDirectory
Creates a new root directory with the given name. -
createRegularFile
RegularFile createRegularFile()Creates a new regular file. -
createSymbolicLink
Creates a new symbolic link referencing the given target path. -
copyWithoutContent
Creates and returns a copy of the given file.- Throws:
IOException
-
directoryCreator
Returns a supplier that creates directories. -
regularFileCreator
Returns a supplier that creates regular files. -
symbolicLinkCreator
Returns a supplier that creates a symbolic links to the given path.
-