Class FilePathEncrypt

    • Constructor Detail

      • FilePathEncrypt

        public FilePathEncrypt()
    • Method Detail

      • register

        public static void register()
        Register this file system.
      • open

        public java.nio.channels.FileChannel open​(java.lang.String mode)
                                           throws java.io.IOException
        Description copied from class: FilePath
        Open a random access file object.
        Overrides:
        open in class FilePathWrapper
        Parameters:
        mode - the access mode. Supported are r, rw, rws, rwd
        Returns:
        the file object
        Throws:
        java.io.IOException - If an I/O error occurs
      • getScheme

        public java.lang.String getScheme()
        Description copied from class: FilePath
        Get the scheme (prefix) for this file provider. This is similar to java.nio.file.spi.FileSystemProvider.getScheme.
        Specified by:
        getScheme in class FilePath
        Returns:
        the scheme
      • unwrap

        public FilePath unwrap​(java.lang.String fileName)
        Description copied from class: FilePathWrapper
        Get the base path for the given wrapped path.
        Overrides:
        unwrap in class FilePathWrapper
        Parameters:
        fileName - the path including the scheme prefix
        Returns:
        the base file path
      • size

        public long size()
        Description copied from class: FilePath
        Get the size of a file in bytes
        Overrides:
        size in class FilePathWrapper
        Returns:
        the size in bytes
      • newOutputStream

        public java.io.OutputStream newOutputStream​(boolean append)
                                             throws java.io.IOException
        Description copied from class: FilePath
        Create an output stream to write into the file.
        Overrides:
        newOutputStream in class FilePathWrapper
        Parameters:
        append - if true, the file will grow, if false, the file will be truncated first
        Returns:
        the output stream
        Throws:
        java.io.IOException - If an I/O error occurs
      • newInputStream

        public java.io.InputStream newInputStream()
                                           throws java.io.IOException
        Description copied from class: FilePath
        Create an input stream to read from the file.
        Overrides:
        newInputStream in class FilePathWrapper
        Returns:
        the input stream
        Throws:
        java.io.IOException - If an I/O error occurs
      • parse

        private java.lang.String[] parse​(java.lang.String fileName)
        Split the file name into algorithm, password, and base file name.
        Parameters:
        fileName - the file name
        Returns:
        an array with algorithm, password, and base file name
      • getPasswordBytes

        public static byte[] getPasswordBytes​(char[] passwordChars)
        Convert a char array to a byte array, in UTF-16 format. The char array is not cleared after use (this must be done by the caller).
        Parameters:
        passwordChars - the password characters
        Returns:
        the byte array