Class FileOnDiskWithChecksum

    • Field Detail

      • CHECKSUM_FILE_SUFFIX

        public static final String CHECKSUM_FILE_SUFFIX
        The file suffix for checksum files.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FileOnDiskWithChecksum

        public FileOnDiskWithChecksum​(String name,
                                      byte[] bytes)
        Creates a new file on disk. A separate checksum will be generated automatically in the same folder.
        Parameters:
        name - the name of the file
        bytes - the content of the file
    • Method Detail

      • getBytesForChecksum

        protected byte[] getBytesForChecksum()
        Fetches the target bytes for computation of the checksum. Will take the bytes of its FileOnDisk.
        Returns:
        the checksum bytes
      • isChecksumFile

        public static boolean isChecksumFile​(Path path)
        Checks whether the given path translate to a checksum file.
        Parameters:
        path - the path handle of the checksum file
        Returns:
        true if it is a checksum file, false otherwise
      • buildChecksumPathForFile

        public static Path buildChecksumPathForFile​(Path file)
        Constructs and returns the checksum Path handle for a given file.
        Parameters:
        file - the file to create the checksum path for
        Returns:
        the checksum path, which incorporates the original file + the checksum suffix.