Java Reference
In-Depth Information
private void openStore() throws RecordStoreException {
if (store == null) {
store = RecordStore.openRecordStore(storeName, true);
}
}
private void closeStore() {
if (store != null) {
try {
store.closeRecordStore();
} catch( Exception ex ) {}
store = null;
}
}
public String[] getLocationStrings() {
String[] result = null;
try {
openStore();
result = new String[store.getNumRecords()];
RecordEnumeration e = store.enumerateRecords(
null, // No filter
new RecordComparator () {
public int compare(byte[] b1, byte[] b2) {
Location r1 = new Location(b1);
Location r2 = new Location(b2);
if (r1.getLocation().compareTo(
r2.getLocation()) == 0) {
return RecordComparator.EQUIVALENT;
} else
if (r1.getLocation().compareTo(
r2.getLocation()) < 0) {
return RecordComparator.PRECEDES;
} else {
return RecordComparator.FOLLOWS;
}
}
},
false);
int i;
 
Search WWH ::




Custom Search