Class MemoryFileSystemBuilder

    • Method Detail

      • addRoot

        public MemoryFileSystemBuilder addRoot​(String root)
        Add a file system root.

        This method is intended to be used in Windows mode to add a drive letter eg.:

        builder.addRoot("D:\\")
        Parameters:
        root - the file system root
        Returns:
        the current builder object
      • addForbiddenCharacter

        public MemoryFileSystemBuilder addForbiddenCharacter​(char c)
        Forbids a character to be used in a name.
        Parameters:
        c - the character to forbid
        Returns:
        the current builder object
      • setUmask

        public MemoryFileSystemBuilder setUmask​(Set<PosixFilePermission> umask)
        Sets the umask. The umask is a set of permissions that will be removed from newly created files.
        Parameters:
        umask - the permissions that will be removed from newly created files
        Returns:
        the current builder object
        See Also:
        umsaks.
      • addFileAttributeView

        public MemoryFileSystemBuilder addFileAttributeView​(String fileAttributeViewName)
        Adds support for an attribute view.
        Parameters:
        fileAttributeViewName - the name of the attribute view to add
        Returns:
        the current builder object
        See Also:
        AttributeView.name()
      • addFileAttributeView

        public MemoryFileSystemBuilder addFileAttributeView​(Class<? extends FileAttributeView> fileAttributeView)
        Adds support for an attribute view.
        Parameters:
        fileAttributeView - the attribute view class
        Returns:
        the current builder object
      • setCurrentWorkingDirectory

        public MemoryFileSystemBuilder setCurrentWorkingDirectory​(String currentWorkingDirectory)
        Sets the current working directory used for resolving relative paths.
        Parameters:
        currentWorkingDirectory - path of the current working directory
        Returns:
        the current builder object
      • setStoreTransformer

        public MemoryFileSystemBuilder setStoreTransformer​(StringTransformer storeTransformer)
        Sets the transformer that controls how a file name is stored.
        Parameters:
        storeTransformer - to apply to the file names before storing
        Returns:
        the current builder object
      • setCaseSensitive

        public MemoryFileSystemBuilder setCaseSensitive​(boolean caseSensitive)
        Toggles case sensitivity.
        Parameters:
        caseSensitive - whether the file names should be case sensitive
        Returns:
        the current builder object
        See Also:
        setLocale(Locale)
      • setLookUpTransformer

        public MemoryFileSystemBuilder setLookUpTransformer​(StringTransformer lookUpTransformer)
        Sets the transformer that controls how a file name is looked up.
        Parameters:
        lookUpTransformer - to apply to the file names for lookup
        Returns:
        the current builder object
      • setCollator

        public MemoryFileSystemBuilder setCollator​(Collator collator)
        Sets the collator used for name comparisons.
        Parameters:
        collator - the collator for name comparisons
        Returns:
        the current builder object
      • newEmpty

        public static MemoryFileSystemBuilder newEmpty()
        Creates a builder for a very basic file system.

        The file system does not support permissions and only supports BasicFileAttributeView. It is UNIX-like in the sense that is uses "/" as a separator, has a single root and is case sensitive and case preserving.

        Returns:
        the builder
      • newLinux

        public static MemoryFileSystemBuilder newLinux()
        Creates a builder for a Linux-like file system.

        The file system has the following properties:

        • the root is "/"
        • the separator is "/"
        • the current user (value of the "user.name" system property) is added as a user
        • the current user (value of the "user.name" system property) is added as a group
        • PosixFileAttributeView is added as an attribute view
        • the current working directory is "/home/${user.name}"
        • the file system is case sensitive
        • 0x00 is not allowed in file names
        Returns:
        the builder
      • newMacOs

        public static MemoryFileSystemBuilder newMacOs()
        Creates a builder for a macOS-like file system.

        The file system has the following properties:

        • the root is "/"
        • the separator is "/"
        • the current user (value of the "user.name" system property) is added as a user
        • the current user (value of the "user.name" system property) is added as a group
        • PosixFileAttributeView is added as an attribute view
        • the current working directory is "/Users/${user.name}"
        • the file system is case insensitive and case case preserving
        • file names are normalized to NFC
        • 0x00 is not allowed in file names
        Returns:
        the builder
      • newMacOsOldJvm

        public static MemoryFileSystemBuilder newMacOsOldJvm()
        Creates a builder for a macOS-like file system for old JVMs.

        The file system has the following properties:

        • the root is "/"
        • the separator is "/"
        • the current user (value of the "user.name" system property) is added as a user
        • the current user (value of the "user.name" system property) is added as a group
        • PosixFileAttributeView is added as an attribute view
        • the current working directory is "/Users/${user.name}"
        • the file system is case insensitive and case case preserving
        • file names are normalized to NFD
        • 0x00 is not allowed in file names
        Returns:
        the builder
      • newWindows

        public static MemoryFileSystemBuilder newWindows()
        Creates a builder for a Windows-like file system.

        The file system has the following properties:

        • the root is "C:\\"
        • the separator is "\\"
        • the current user (value of the "user.name" system property) is added as a user
        • the current user (value of the "user.name" system property) is added as a group
        • DosFileAttributeView is added as an attribute view
        • the current working directory is "C:\\Users\\${user.name}"
        • the file system is case insensitive and case case preserving
        • '\\', '/', ':', '*', '?', '"', '<', '<' and '|' and not allowed in file names
        Returns:
        the builder