Class Pack

    • Field Detail

      • SORT

        public static final Comparator<Pack> SORT
        Sorts PackFiles to be most recently created to least recently created.
    • Constructor Detail

      • Pack

        public Pack​(File packFile,
                    PackFile bitmapIdxFile)
        Construct a reader for an existing, pre-indexed packfile.
        packFile - path of the .pack file holding the data.
        bitmapIdxFile - existing bitmap index file with the same base as the pack
    • Method Detail

      • getPackFile

        public PackFile getPackFile()
        Get the File object which locates this pack on disk.
        the File object which locates this pack on disk.
      • getPackName

        public String getPackName()
        Get name extracted from pack-*.pack pattern.
        name extracted from pack-*.pack pattern.
      • hasObject

        public boolean hasObject​(AnyObjectId id)
                          throws IOException
        Determine if an object is contained within the pack file.

        For performance reasons only the index file is searched; the main pack content is ignored entirely.

        id - the object to look for. Must not be null.
        true if the object is in this pack; false otherwise.
        IOException - the index file cannot be loaded into memory.
      • shouldBeKept

        public boolean shouldBeKept()
        Determines whether a .keep file exists for this pack file.
        true if a .keep file exist.
      • close

        public void close()
        Close the resources utilized by this repository