本文整理匯總了Java中net.openrs.cache.type.varbits.VarBitType類的典型用法代碼示例。如果您正苦於以下問題:Java VarBitType類的具體用法?Java VarBitType怎麽用?Java VarBitType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VarBitType類屬於net.openrs.cache.type.varbits包,在下文中一共展示了VarBitType類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: lookupVarBit
import net.openrs.cache.type.varbits.VarBitType; //導入依賴的package包/類
public static final VarBitType lookupVarBit(int id) {
return varbit.list(id);
}
示例2: dumpVarbitDefs
import net.openrs.cache.type.varbits.VarBitType; //導入依賴的package包/類
@FXML
private void dumpVarbitDefs() {
if (!cacheDirectory.isPresent()) {
DirectoryChooser cacheChooser = new DirectoryChooser();
cacheChooser.setTitle("Select directory containing osrs cache.");
Optional<File> cacheResult = Optional.ofNullable(cacheChooser.showDialog(App.getStage()));
if (!cacheResult.isPresent()) {
return;
}
cacheDirectory = cacheResult;
}
createTask(new Task<Void>() {
@Override
protected Void call() throws Exception {
try (Cache cache = new Cache(FileStore.open(cacheDirectory.get().toPath().toString()))) {
File dir = new File("./dump/");
if (!dir.exists()) {
dir.mkdirs();
}
VarBitTypeList list = new VarBitTypeList();
list.initialize(cache);
@Cleanup
DataOutputStream dat = new DataOutputStream(new FileOutputStream(new File(dir, "varbit.dat")));
dat.writeShort(list.size());
for (int i = 0; i < list.size(); i++) {
VarBitType varbit = list.list(i);
if (varbit == null) {
varbit = list.list(1);
}
dat.writeShort(varbit.getConfigID());
dat.writeByte(varbit.getLeastSigBit());
dat.writeByte(varbit.getMostSigBit());
double progress = ((double) (i + 1) / list.size()) * 100;
updateMessage(String.format("%.2f%s", progress, "%"));
updateProgress((i + 1), list.size());
}
Platform.runLater(() -> {
Dialogue.openDirectory("Would you like to view this file?", dir);
});
System.out.println(String.format("Dumped %d varbits", list.size()));
}
return null;
}
});
}