Revision: 5877 http://jnode.svn.sourceforge.net/jnode/?rev=5877&view=rev Author: galatnm Date: 2011-12-14 12:19:38 +0000 (Wed, 14 Dec 2011) Log Message: ----------- FS : Improve HFS catalog key javadocs.
Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java Modified: trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2011-12-12 16:09:48 UTC (rev 5876) +++ trunk/fs/src/fs/org/jnode/fs/hfsplus/catalog/CatalogKey.java 2011-12-14 12:19:38 UTC (rev 5877) @@ -17,7 +17,7 @@ * along with this library; If not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - + package org.jnode.fs.hfsplus.catalog; import org.jnode.fs.hfsplus.HfsUnicodeString; @@ -25,6 +25,17 @@ import org.jnode.fs.hfsplus.tree.Key; import org.jnode.util.BigEndian; +/** + * Implementation of catalog file key. The catalog file key is defined as following : + * <ul> + * <li>The length of the key</li> + * <li>The node identifier of the parent folder</li> + * <li>The name of the file or folder</li> + * </ul> + * + * The minimal length for a key is 6 bytes. 2 bytes for the length and 4 bytes for the catalog node id. + * + */ public class CatalogKey extends AbstractKey { public static final int MINIMUM_KEY_LENGTH = 6; @@ -44,7 +55,7 @@ * @param src * @param offset */ - + public CatalogKey(final byte[] src, final int offset) { int currentOffset = offset; byte[] ck = new byte[2]; @@ -96,8 +107,8 @@ res = this.getParentId().compareTo(ck.getParentId()); if (res == 0) { res = - this.getNodeName().getUnicodeString().compareTo( - ck.getNodeName().getUnicodeString()); + this.getNodeName().getUnicodeString() + .compareTo(ck.getNodeName().getUnicodeString()); } } return res; @@ -109,11 +120,11 @@ * @see org.jnode.fs.hfsplus.tree.AbstractKey#getBytes() */ public byte[] getBytes() { - int length = this.getKeyLength(); + 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); + System.arraycopy(nodeName.getBytes(), 0, data, 6, (nodeName.getLength() * 2) + 2); return data; } @@ -124,9 +135,9 @@ */ public final String toString() { StringBuffer s = new StringBuffer(); - s.append("[length, Parent ID, Node name]:").append(getKeyLength()).append(",").append( - getParentId().getId()).append(",").append( - (getNodeName() != null) ? getNodeName().getUnicodeString() : ""); + s.append("[length, Parent ID, Node name]:").append(getKeyLength()).append(",") + .append(getParentId().getId()).append(",") + .append((getNodeName() != null) ? getNodeName().getUnicodeString() : ""); return s.toString(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Cloud Computing - Latest Buzzword or a Glimpse of the Future? This paper surveys cloud computing today: What are the benefits? Why are businesses embracing it? What are its payoffs and pitfalls? http://www.accelacomm.com/jaw/sdnl/114/51425149/ _______________________________________________ Jnode-svn-commits mailing list Jnode-svn-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits