/** * Read in the root-level index from the given input stream. Must match * what was written into the root level by * {@link BlockIndexWriter#writeIndexBlocks(FSDataOutputStream)} at the * offset that function returned. * * @param in the buffered input stream or wrapped byte input stream * @param numEntries the number of root-level index entries * @throws IOException */ public void readRootIndex(DataInput in, final int numEntries) throws IOException { blockOffsets = new long[numEntries]; initialize(numEntries); blockDataSizes = new int[numEntries]; // If index size is zero, no index was written. if (numEntries > 0) { for (int i = 0; i < numEntries; ++i) { long offset = in.readLong(); int dataSize = in.readInt(); byte[] key = Bytes.readByteArray(in); add(key, offset, dataSize); } } }
/** * Read in the root-level index from the given input stream. Must match * what was written into the root level by * {@link BlockIndexWriter#writeIndexBlocks(FSDataOutputStream)} at the * offset that function returned. * * @param in the buffered input stream or wrapped byte input stream * @param numEntries the number of root-level index entries * @throws IOException */ public void readRootIndex(DataInput in, final int numEntries) throws IOException { blockOffsets = new long[numEntries]; blockKeys = new byte[numEntries][]; blockDataSizes = new int[numEntries]; // If index size is zero, no index was written. if (numEntries > 0) { for (int i = 0; i < numEntries; ++i) { long offset = in.readLong(); int dataSize = in.readInt(); byte[] key = Bytes.readByteArray(in); add(key, offset, dataSize); } } }
/** * Read in the root-level index from the given input stream. Must match * what was written into the root level by * {@link BlockIndexWriter#writeIndexBlocks(FSDataOutputStream)} at the * offset that function returned. * * @param in the buffered input stream or wrapped byte input stream * @param numEntries the number of root-level index entries * @throws IOException */ public void readRootIndex(DataInput in, final int numEntries) throws IOException { blockOffsets = new long[numEntries]; blockKeys = new byte[numEntries][]; blockDataSizes = new int[numEntries]; // If index size is zero, no index was written. if (numEntries > 0) { for (int i = 0; i < numEntries; ++i) { long offset = in.readLong(); int dataSize = in.readInt(); byte[] key = Bytes.readByteArray(in); add(key, offset, dataSize); } } }