Class BitarchiveARCFile


  • public class BitarchiveARCFile
    extends Object
    The representation of an ARC file in the bit archive. This class keeps the connection between the name that was used for lookup and the file that was found.
    • Constructor Detail

      • BitarchiveARCFile

        public BitarchiveARCFile​(String fn,
                                 File fp)
                          throws ArgumentNotValid
        Create a new representation of a file in the archive. Note that fn is not necessarily, though probably, the same as fp.getName().

        Failed lookups should be represented by null references rather than an object representing something that doesn't exist.

        Parameters:
        fn - The ARC name of the file, as used in lookup in the archive.
        fp - The actual path of the file in the archive.
        Throws:
        ArgumentNotValid - if either argument is null, or any of the file name representaitons is the empty string.
    • Method Detail

      • exists

        public boolean exists()
        Return true if the file exists, false otherwise. Note that failure to exist indicates a severe error in the bit archive, not just that the lookup failed.
        Returns:
        Whether the file exists
      • getName

        public String getName()
        Get the ARC name of this file. This is the name that the file can be found under when looking up in the bit archive.
        Returns:
        A String representing the ARC name of this file.
      • getFilePath

        public File getFilePath()
        Get the full file path of this file.
        Returns:
        A path where this file can be found in the bit archive.
      • getSize

        public long getSize()
        Get the size of this file. If the file does not exist, the size is 0L.
        Returns:
        The size of this file.