java.lang.Object
org.eclipse.jgit.internal.storage.midx.MidxMetadataReader
Read only basic metadata from the midx without loading the whole file in
memory.
In some cases we need only a bit of information from the midx and we do not need it yet fully loaded in memory. For example:
- We need the checksum of the previous midx to delete its bitmaps
- When opening the repo, we need the names of packs referenced by the midx to check they exist
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordMetadata useful before loading the full midxstatic classThrown if a MultiPackIndex doesn't have the expected file format -
Method Summary
Modifier and TypeMethodDescriptionOpen an existing MultiPackIndex file and read its metadataread(InputStream fd) Read metadata from an existing MultiPackIndex from a buffered stream.
-
Method Details
-
read
public static MidxMetadataReader.MidxMetadata read(File midxFile) throws FileNotFoundException, MidxMetadataReader.MultiPackIndexFormatException, IOException Open an existing MultiPackIndex file and read its metadata- Parameters:
midxFile- existing multi-pack-index to read.- Returns:
- the metadata
- Throws:
FileNotFoundException- the file does not exist.MidxMetadataReader.MultiPackIndexFormatException- MultiPackIndex file's format is different from we expected.IOException- the file exists but could not be read due to security errors or unexpected data corruption.
-
read
public static MidxMetadataReader.MidxMetadata read(InputStream fd) throws MidxMetadataReader.MultiPackIndexFormatException, IOException Read metadata from an existing MultiPackIndex from a buffered stream.- Parameters:
fd- stream to read the multipack-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.- Returns:
- the metadata
- Throws:
MidxMetadataReader.MultiPackIndexFormatException- the MultiPackIndex file's format is different from we expected.IOException- the stream cannot be read.
-