Class BinaryStubBundle
java.lang.Object
org.checkerframework.framework.stub.BinaryStubBundle
In-memory index of a binary stub bundle: a single file combining the binary form of
every
.astub file under one -Astubs directory, as written by
BinaryStubFileGenerator's --bundle mode. Conventionally named with the SUFFIX
suffix, as a sibling of the directory it covers.
A bundle is a container, not a merged BinaryStubData: each entry holds the exact bytes
a per-file .astub.bin.gz would, generated independently, so each entry has its own
constant and annotation pools whose indices are meaningful only within that entry. Entry bytes
are read eagerly; get(java.lang.String) parses an entry into a BinaryStubData only when requested.
The binary format consists of:
- A 4-byte magic number (
MAGIC). - A 2-byte version number.
- An entry count.
- For each entry: its slash-separated path (relative to the bundled directory), a 4-byte byte
length, and that many raw bytes -- the complete, independently gzip-compressed contents a
per-file
.astub.bin.gzwould hold for that source file.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReads a bundle's directory of entries from the given stream. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the bundle has an entry forrelativePath, without parsing it, unlikeget(java.lang.String).Returns the binary stub data for the entry atrelativePath, parsing it on this call.
-
Field Details
-
MAGIC
public static final int MAGICMagic number identifying a binary stub bundle.- See Also:
-
VERSION
public static final short VERSIONFormat version of the bundle container.- See Also:
-
SUFFIX
File-name suffix appended to a source stub directory's name to name the bundle covering it (e.g. a-Astubsdirectory namedmystubs→ sibling filemystubs.astub.bin.gz).- See Also:
-
-
Constructor Details
-
BinaryStubBundle
Reads a bundle's directory of entries from the given stream.- Parameters:
in- the input stream to read from; the stream is closed when this constructor returns- Throws:
IOException- if the stream cannot be read or contains an invalid/unsupported format
-
-
Method Details
-
get
Returns the binary stub data for the entry atrelativePath, parsing it on this call. The result is not cached.- Parameters:
relativePath- the entry's path, relative to the bundled directory, with'/'as separator- Returns:
- the entry's binary stub data, or null if the bundle has no entry for that path
- Throws:
IOException- if the entry's bytes cannot be parsed as binary stub data
-
contains
Returns true if the bundle has an entry forrelativePath, without parsing it, unlikeget(java.lang.String).- Parameters:
relativePath- the entry's path, relative to the bundled directory, with'/'as separator- Returns:
- true if the bundle has an entry for
relativePath
-