code: private int debugSegmentIndex(WriteStream out,
                                  ReadStream is,
                                  byte []buffer,
                                  long segmentAddress,
                                  long ptr,
                                  int head,
                                  TableEntry table)
      throws IOException
    {
      int sublen = 1 + 4 * 4;
      
      //tail -= sublen;
      
      // is.position(ptr + tail);
      int typeCode = buffer[head] & 0xff;
      head++;
      
      if (typeCode <= 0) {
        return 0;
      }
      
      Type type = Type.valueOf(typeCode);
  
      int pid = BitsUtil.readInt(buffer, head);
      head += 4;
      int nextPid = BitsUtil.readInt(buffer, head);
      head += 4;
      int offset = BitsUtil.readInt(buffer, head);
      head += 4;
      int length = BitsUtil.readInt(buffer, head);
      head += 4;
      
      switch (type) {
      case LEAF:
        out.print("  " + type);
        debugLeaf(out, is, segmentAddress, offset, table);
        break;
        
      case LEAF_DELTA:
        out.print("  " + type);
        break;
  
      case BLOB:
      case BLOB_FREE:
        out.print("  " + type);
        break;
        
      default:
        out.print("  unk(" + type + ")");
        break;
      }
      
      // is.position(pos);
    
      out.println(" pid:" + pid + " next:" + nextPid
                  + " offset:" + offset + " length:" + length);
      
      return head;
    }
docs: Debug a single segment index entry.