Class PackBitmapIndex

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int FLAG_REUSE
      Flag bit denoting the bitmap should be reused during index creation.
    • Constructor Summary

      Constructors 
      Constructor Description
      PackBitmapIndex()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract int findPosition​(AnyObjectId objectId)
      Finds the position in the bitmap of the object.
      abstract com.googlecode.javaewah.EWAHCompressedBitmap getBitmap​(AnyObjectId objectId)
      Returns the previously constructed bitmap for the object.
      abstract ObjectId getObject​(int position)
      Get the object at the bitmap position.
      abstract int getObjectCount()
      Obtain the total number of objects described by this index.
      abstract com.googlecode.javaewah.EWAHCompressedBitmap ofObjectType​(com.googlecode.javaewah.EWAHCompressedBitmap bitmap, int type)
      Returns a bitmap containing positions for objects that have the given Git type.
      static PackBitmapIndex open​(java.io.File idxFile, PackIndex packIndex, PackReverseIndex reverseIndex)
      Read an existing pack bitmap index file from a buffered stream.
      static PackBitmapIndex read​(java.io.InputStream fd, PackIndex packIndex, PackReverseIndex reverseIndex)
      Read an existing pack bitmap index file from a buffered stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FLAG_REUSE

        public static final int FLAG_REUSE
        Flag bit denoting the bitmap should be reused during index creation.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PackBitmapIndex

        public PackBitmapIndex()
    • Method Detail

      • open

        public static PackBitmapIndex open​(java.io.File idxFile,
                                           PackIndex packIndex,
                                           PackReverseIndex reverseIndex)
                                    throws java.io.IOException
        Read an existing pack bitmap index file from a buffered stream.

        The format of the file will be automatically detected and a proper access implementation for that format will be constructed and returned to the caller. The file may or may not be held open by the returned instance.

        Parameters:
        idxFile - existing pack .bitmap to read.
        packIndex - the pack index for the corresponding pack file.
        reverseIndex - the pack reverse index for the corresponding pack file.
        Returns:
        a copy of the index in-memory.
        Throws:
        java.io.IOException - the stream cannot be read.
        CorruptObjectException - the stream does not contain a valid pack bitmap index.
      • read

        public static PackBitmapIndex read​(java.io.InputStream fd,
                                           PackIndex packIndex,
                                           PackReverseIndex reverseIndex)
                                    throws java.io.IOException
        Read an existing pack bitmap index file from a buffered stream.

        The format of the file will be automatically detected and a proper access implementation for that format will be constructed and returned to the caller. The file may or may not be held open by the returned instance.

        Parameters:
        fd - stream to read the bitmap index file from. The stream must be buffered as some small IOs are performed against the stream. The caller is responsible for closing the stream.
        packIndex - the pack index for the corresponding pack file.
        reverseIndex - the pack reverse index for the corresponding pack file.
        Returns:
        a copy of the index in-memory.
        Throws:
        java.io.IOException - the stream cannot be read.
        CorruptObjectException - the stream does not contain a valid pack bitmap index.
      • findPosition

        public abstract int findPosition​(AnyObjectId objectId)
        Finds the position in the bitmap of the object.
        Parameters:
        objectId - the id for which the bitmap position will be found.
        Returns:
        the bitmap id or -1 if the object was not found.
      • getObject

        public abstract ObjectId getObject​(int position)
                                    throws java.lang.IllegalArgumentException
        Get the object at the bitmap position.
        Parameters:
        position - the id for which the object will be found.
        Returns:
        the ObjectId.
        Throws:
        java.lang.IllegalArgumentException - when the item is not found.
      • ofObjectType

        public abstract com.googlecode.javaewah.EWAHCompressedBitmap ofObjectType​(com.googlecode.javaewah.EWAHCompressedBitmap bitmap,
                                                                                  int type)
        Returns a bitmap containing positions for objects that have the given Git type.
        Parameters:
        bitmap - the object bitmap.
        type - the Git type.
        Returns:
        the object bitmap with only objects of the Git type.
      • getBitmap

        public abstract com.googlecode.javaewah.EWAHCompressedBitmap getBitmap​(AnyObjectId objectId)
        Returns the previously constructed bitmap for the object.
        Parameters:
        objectId - the id for which the bitmap will be found.
        Returns:
        the bitmap or null if the object was not found.
      • getObjectCount

        public abstract int getObjectCount()
        Obtain the total number of objects described by this index. getObjectCount() - 1 is the largest bit that will be set in a bitmap.
        Returns:
        number of objects in this index, and likewise in the associated pack that this index was generated from.