![]() ![]() |
BTree Quick Start (Implementation for Java Platform) |
Home | B+Tree Product | B+Tree Guide | B+Tree Performance | Demos | Licensing and Pricing | B+Tree FAQ |
![]() |
Quick Start (Implementation for Java Platform)This code is designed to show you how easy it is to use the Virtual Machinery implementation of the BTree classes for the Java platform. This applies to the BTree on any Java platform, J2SE, J2EE. J2ME and Android. This page shows you all the basic operations including opening and closing a BTree, adding, fetching and deleting data and closing the BTree.Creating a new BTreeObviously the first time you use this software you will be creating a new BTree so lets do that -
The message protocol follows that of the Java Hashtable classes - put(index,data) adds data to the BTree, get(index) retrieves it and remove(index) removes it. In the standard access methods both data and index must implement the BTreeRecordInterface interface but convenience methods which use the String class are also provided and these are used in the examples here. As you can see nothing was output for the second attempt to get the data at 'MYINDEX' since we had deleted the data. If you are using the BTreeRecordInterface you can use the createRecord(String) or createRecord(byte[]) methods implemented by the BTree class. e.g.
Since all the data within the BTree is held in variables that satisfy the BTreeRecordInterface interface it is possible to use both styles (String and BTreeRecordInterface) to add, access and remove data in the tree.
Opening an existing BtreeYou can also open an existing tree - so lets re-open the tree we created above- as you can see we can still access the data at "MYNEXTINDEX" -
myTree = BTree.openExistingTree("MYTREE");
These are the basics of using the BTree in your code - for more details of the other options and for how to use the B+Tree libraries in both Java and Objective-c (for iOS (iPhone and iPad) platforms see the demos that you can download here. |
![]() |
All Content © 2020 Virtual Machinery All Rights Reserved.
Portions of this page are reproduced from work created and shared by Google and used according to terms described in the Creative Commons 2.5 Attribution License. Some of the icons in this page are generously provided by MySiteMyWay |