Package org.exist.storage.btree

Examples of org.exist.storage.btree.BTree$BTreeFileHeader


        System.out.println("testRead() ...\n");
       
        DBBroker broker = null;
        try {
            broker = pool.get(pool.getSecurityManager().getSystemSubject());
            BTree btree = ((NativeBroker)broker).getStorage(NativeBroker.COLLECTIONS_DBX_ID);
            Writer writer = new StringWriter();
            btree.dump(writer);
            System.out.println(writer.toString());
           
            Collection test = broker.getCollection(TEST_COLLECTION_URI.append("test2"));
            assertNotNull(test);
            System.out.println("Contents of collection " + test.getURI() + ":");
View Full Code Here


        pool.shutdown(false);
    }

    public void create(int count) throws DBException, IOException {
        file.delete();
        BTree btree = null;
        try {
            btree = new BTree(pool, (byte) 0, false, pool.getCacheManager(), file, 0.1);
            btree.create((short) -1);

            String prefixStr = "KEY";
            for (int i = 1; i <= count; i++) {
                Value value = new Value(prefixStr + Integer.toString(i));
                btree.addValue(value, i);
            }
            btree.flush();

            OutputStreamWriter writer = new OutputStreamWriter(System.out);
            btree.dump(writer);
            writer.flush();
        } finally {
            if (btree != null) {
                btree.close();
            }
        }
    }
View Full Code Here

            }
        }
    }

    public void rebuild() throws DBException, IOException, TerminatedException {
        BTree btree = null;
        try {
            System.out.println("Loading btree ...");
            btree = new BTree(pool, (byte) 0, false, pool.getCacheManager(), file, 0.1);
            btree.open((short)-1);

            System.out.println("Rebuilding ...");
            btree.rebuild();

            OutputStreamWriter writer = new OutputStreamWriter(System.out);
            btree.dump(writer);
            writer.flush();
        } finally {
            if (btree != null) {
                btree.close();
            }
        }
    }
View Full Code Here

            }
        }
    }

    public void read(int count) throws DBException, IOException, TerminatedException {
        BTree btree = null;
        try {
            System.out.println("Loading btree ...");
            btree = new BTree(pool, (byte) 0, false, pool.getCacheManager(), file, 0.1);
            btree.open((short)-1);

            String prefixStr = "KEY";
            for (int i = 1; i <= count; i++) {
                Value value = new Value(prefixStr + Integer.toString(i));
                long r = btree.findValue(value);
                if (r == -1) {
                    System.out.println("Key not found: " + i);
                }
            }
        } finally {
            if (btree != null) {
                btree.close();
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.exist.storage.btree.BTree$BTreeFileHeader

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.