PackBitmapIndex getBitmapIndex(DfsReader ctx) throws IOException {
if (invalid || isGarbage())
return null;
DfsBlockCache.Ref<PackBitmapIndex> idxref = bitmapIndex;
if (idxref != null) {
PackBitmapIndex idx = idxref.get();
if (idx != null)
return idx;
}
if (!packDesc.hasFileExt(PackExt.BITMAP_INDEX))
return null;
synchronized (initLock) {
idxref = bitmapIndex;
if (idxref != null) {
PackBitmapIndex idx = idxref.get();
if (idx != null)
return idx;
}
long size;
PackBitmapIndex idx;
try {
ReadableChannel rc = ctx.db.openFile(packDesc, BITMAP_INDEX);
try {
InputStream in = Channels.newInputStream(rc);
int wantSize = 8192;