SymbolTableEntry { public SymbolTableEntry(HdfFileChannel fc, long address) { this.address = address; final int size = fc.getSizeOfOffsets() * 2 + 4 + 4 + 16; final ByteBuffer bb = fc.readBufferFromAddress(address, size); linkNameOffset = Utils.readBytesAsUnsignedInt(bb, fc.getSizeOfOffsets()); logger.trace("linkNameOffset = {}", linkNameOffset); objectHeaderAddress = Utils.readBytesAsUnsignedLong(bb, fc.getSizeOfOffsets()); logger.trace("objectHeaderAddress = {}", objectHeaderAddress); cacheType = Utils.readBytesAsUnsignedInt(bb, 4); logger.trace("cacheType = {}", cacheType); bb.get(new byte[4]); switch (cacheType) { case 0: break; case 1: bTreeAddress = Utils.readBytesAsUnsignedLong(bb, fc.getSizeOfOffsets()); logger.trace("addressOfBTree = {}", bTreeAddress); nameHeapAddress = Utils.readBytesAsUnsignedLong(bb, fc.getSizeOfOffsets()); logger.trace("nameHeapAddress = {}", nameHeapAddress); break; case 2: linkValueOffset = Utils.readBytesAsUnsignedInt(bb, 4); logger.trace("linkValueOffset = {}", linkValueOffset); break; default: throw new IllegalStateException("SymbolTableEntry: Unrecognized cache type = " + cacheType); } } SymbolTableEntry(HdfFileChannel fc, long address); long getAddress(); long getBTreeAddress(); int getCacheType(); int getLinkNameOffset(); int getLinkValueOffset(); long getNameHeapAddress(); long getObjectHeaderAddress(); @Override String toString();  }
@Test void testSymbolTableEntry() { SymbolTableEntry ste = new SymbolTableEntry(hdfFc, 56); assertThat(ste.getLinkNameOffset(), is(equalTo(0))); assertThat(ste.getObjectHeaderAddress(), is(equalTo(96L))); assertThat(ste.getCacheType(), is(equalTo(1))); assertThat(ste.getBTreeAddress(), is(equalTo(136L))); assertThat(ste.getNameHeapAddress(), is(equalTo(680L))); assertThat(ste.toString(), is(equalTo( "SymbolTableEntry [address=0x38, linkNameOffset=0, objectHeaderAddress=0x60, cacheType=1, bTreeAddress=0x88, nameHeapAddress=0x2a8, linkValueOffset=-1]"))); }