/* * (non-Javadoc) * * @see org.jnode.fs.hfsplus.tree.AbstractKey#getBytes() */ public byte[] getBytes() { int length = this.getKeyLength(); byte[] data = new byte[length]; BigEndian.setInt16(data, 0, length); System.arraycopy(parentId.getBytes(), 0, data, 2, 4); System.arraycopy(nodeName.getBytes(), 0, data, 6, (nodeName.getLength() * 2) + 2); return data; }
/** @return the thread encoded as data */ public byte[] getBytes() { byte[] data = new byte[512]; BigEndian.setInt16(data, 0, recordType); BigEndian.setInt32(data, 4, (int) parentId.getId()); System.arraycopy(parentId.getBytes(), 0, data, 4, 4); System.arraycopy(nodeName.getBytes(), 0, data, 8, nodeName.getBytes().length); return data; }
/** * Create new catalog key based on parent CNID and the name of the file or folder. * * @param parentID Parent catalog node identifier. * @param name Name of the file or folder. */ public CatalogKey(final CatalogNodeId parentID, final HfsUnicodeString name) { this.parentId = parentID; this.nodeName = name; this.keyLength = MINIMUM_KEY_LENGTH + (name.getLength() * 2) + 2; }