Exemple #1
0
 /**
  * Create catalog thread from existing data.
  *
  * @param src byte array contains catalog thread data.
  */
 public CatalogThread(final byte[] src) {
   byte[] data = new byte[512];
   System.arraycopy(src, 0, data, 0, CATALOG_THREAD_SIZE);
   recordType = BigEndian.getInt16(data, 0);
   parentId = new CatalogNodeId(data, 4);
   nodeName = new HfsUnicodeString(data, 8);
 }
 /**
  * Create catalog key from existing data.
  *
  * @param src
  * @param offset
  */
 public CatalogKey(final byte[] src, final int offset) {
   int currentOffset = offset;
   byte[] ck = new byte[2];
   System.arraycopy(src, currentOffset, ck, 0, 2);
   // TODO Understand why the +2 is necessary
   keyLength = BigEndian.getInt16(ck, 0) + 2;
   currentOffset += 2;
   ck = new byte[4];
   System.arraycopy(src, currentOffset, ck, 0, 4);
   parentId = new CatalogNodeId(ck, 0);
   currentOffset += 4;
   if (keyLength > MINIMUM_KEY_LENGTH) {
     nodeName = new HfsUnicodeString(src, currentOffset);
   }
 }