Package org.jnode.fs.hfsplus

Examples of org.jnode.fs.hfsplus.HfsUnicodeString


    }

    @Test
    public void testConstructFromCNIDAndString() {
        CatalogNodeId id = CatalogNodeId.HFSPLUS_START_CNID;
        HfsUnicodeString string = new HfsUnicodeString(NODE_NAME_AS_STRING);
        CatalogKey key = new CatalogKey(id, string);
        assertEquals(NODE_NAME_AS_STRING, key.getNodeName().getUnicodeString());
        assertEquals(24, key.getKeyLength());
        assertEquals(7, key.getParentId().getId());
View Full Code Here


    }

    @Test
    public void testConstructFromCNIDAndEmptyString() {
        CatalogNodeId id = CatalogNodeId.HFSPLUS_START_CNID;
        HfsUnicodeString string = new HfsUnicodeString("");
        CatalogKey key = new CatalogKey(id, string);
        assertEquals("", key.getNodeName().getUnicodeString());
        assertEquals(8, key.getKeyLength());
        assertEquals(7, key.getParentId().getId());
View Full Code Here

        new byte[]{0, 8, 0, 116, 0, 101, 0, 115, 0, 116, 0, 46, 0, 116, 0, 120, 0, 116};
    private String STRING_AS_TEXT = "test.txt";

    @Test
    public void testConstructAsBytesArray() {
        HfsUnicodeString string = new HfsUnicodeString(STRING_AS_BYTES_ARRAY, 0);
        assertEquals(8, string.getLength());
        assertEquals(STRING_AS_TEXT, string.getUnicodeString());
    }
View Full Code Here

        assertEquals(STRING_AS_TEXT, string.getUnicodeString());
    }

    @Test
    public void testConstructAsString() {
        HfsUnicodeString string = new HfsUnicodeString(STRING_AS_TEXT);
        assertEquals(8, string.getLength());
        byte[] array = string.getBytes();
        int index = 0;
        for (byte b : array) {
            assertEquals(STRING_AS_BYTES_ARRAY[index], b);
            index++;
        }
View Full Code Here

        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);
        }
    }
View Full Code Here

     * Create new catalog key based on parent CNID, ignoring file/folder name.
     *
     * @param parentID Parent catalog node identifier.
     */
    public CatalogKey(CatalogNodeId parentID) {
        this(parentID, new HfsUnicodeString(""));
    }
View Full Code Here

    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);
    }
View Full Code Here

        NodeDescriptor nd =
            new NodeDescriptor(0, 0, NodeDescriptor.BT_LEAF_NODE, 1,
                params.getInitializeNumRecords());
        CatalogLeafNode rootNode = new CatalogLeafNode(nd, nodeSize);
        // First record (folder)
        HfsUnicodeString name = new HfsUnicodeString(params.getVolumeName());
        CatalogKey ck = new CatalogKey(CatalogNodeId.HFSPLUS_POR_CNID, name);
        CatalogFolder folder =
            new CatalogFolder(params.isJournaled() ? 2 : 0, CatalogNodeId.HFSPLUS_ROOT_CNID);
        LeafRecord record = new LeafRecord(ck, folder.getBytes());
        rootNode.addNodeRecord(record);
        // Second record (thread)
        CatalogKey tck = new CatalogKey(CatalogNodeId.HFSPLUS_POR_CNID, name);
        CatalogThread ct =
            new CatalogThread(CatalogFolder.RECORD_TYPE_FOLDER_THREAD,
                CatalogNodeId.HFSPLUS_ROOT_CNID, new HfsUnicodeString(""));
        record = new LeafRecord(tck, ct.getBytes());
        rootNode.addNodeRecord(record);
        log.debug(rootNode.toString());
        return rootNode;
    }
View Full Code Here

     * @return the new node instance
     */
    public CatalogLeafNode createNode(String filename, CatalogNodeId parentId, CatalogNodeId nodeId,
                                      int nodeType) throws IOException {
        CatalogLeafNode node;
        HfsUnicodeString name = new HfsUnicodeString(filename);
        // find parent leaf record.
        LeafRecord record = this.getRecord(parentId, name);
        if (record == null) {
            NodeDescriptor nd = new NodeDescriptor(0, 0, NodeDescriptor.BT_LEAF_NODE, 1, 2);
            node = new CatalogLeafNode(nd, 8192);
View Full Code Here

TOP

Related Classes of org.jnode.fs.hfsplus.HfsUnicodeString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.