本文整理汇总了Java中net.openrs.cache.ReferenceTable.decode方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceTable.decode方法的具体用法?Java ReferenceTable.decode怎么用?Java ReferenceTable.decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.openrs.cache.ReferenceTable
的用法示例。
在下文中一共展示了ReferenceTable.decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
try (FileStore in = FileStore.open(Constants.CACHE_PATH)) {
try (FileStore out = FileStore.create(Constants.CACHETMP_PATH, in.getTypeCount())) {
for (int type = 0; type < in.getTypeCount(); type++) {
ByteBuffer buf = in.read(255, type);
buf.mark();
out.write(255, type, buf);
buf.reset();
ReferenceTable rt = ReferenceTable.decode(Container.decode(buf).getData());
for (int file = 0; file < rt.capacity(); file++) {
if (rt.getEntry(file) == null) {
System.out.println(type + ", " + file);
continue;
}
out.write(type, file, in.read(type, file));
}
}
}
}
}
示例2: main
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
FileStore otherStore = FileStore.open(Constants.CACHEO_PATH);
FileStore store = FileStore.open(Constants.CACHE_PATH);
for (int type = 0; type < store.getFileCount(255); type++) {
ReferenceTable otherTable = ReferenceTable.decode(Container.decode(otherStore.read(255, type)).getData());
ReferenceTable table = ReferenceTable.decode(Container.decode(store.read(255, type)).getData());
for (int file = 0; file < table.capacity(); file++) {
Entry entry = table.getEntry(file);
if (entry == null)
continue;
if (isRepackingRequired(store, entry, type, file)) {
Entry otherEntry = otherTable.getEntry(file);
if (entry.getVersion() == otherEntry.getVersion() && entry.getCrc() == otherEntry.getCrc()) {
store.write(type, file, otherStore.read(type, file));
}
}
}
}
}
示例3: main
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
try (Cache cache = new Cache(FileStore.open(Constants.CACHE_PATH))) {
ReferenceTable table = ReferenceTable.decode(Container.decode(cache.getStore().read(255, 7)).getData());
for (int i = 0; i < table.capacity(); i++) {
if (table.getEntry(i) == null)
continue;
Container container = cache.read(7, i);
byte[] bytes = new byte[container.getData().limit()];
container.getData().get(bytes);
File file = new File(Constants.MODEL_PATH, i + ".dat");
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file));
dos.write(bytes);
dos.close();
}
}
}
示例4: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.VARCLIENT);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.VARCLIENT).getData(), entry.size());
varClients = new VarClientType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
VarClientType type = new VarClientType(id);
type.decode(buffer);
varClients[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading VarClientType(s)!", e);
}
logger.info("Loaded " + count + " VarClientType(s)!");
}
示例5: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.OBJECT);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.OBJECT).getData(), entry.size());
objs = new ObjectType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
ObjectType type = new ObjectType(id);
type.decode(buffer);
objs[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading ObjectType(s)!", e);
}
logger.info("Loaded " + count + " ObjectType(s)!");
}
示例6: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.VARCLIENTSTRING);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.VARCLIENTSTRING).getData(), entry.size());
varClients = new VarClientStringType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
VarClientStringType type = new VarClientStringType(id);
type.decode(buffer);
varClients[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading VarClientStringType(s)!", e);
}
logger.info("Loaded " + count + " VarClientStringType(s)!");
}
示例7: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.IDENTKIT);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.IDENTKIT).getData(), entry.size());
kits = new IdentkitType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
IdentkitType type = new IdentkitType(id);
type.decode(buffer);
kits[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading IdentkitType(s)!", e);
}
logger.info("Loaded " + count + " IdentkitType(s)!");
}
示例8: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.OVERLAY);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.OVERLAY).getData(), entry.size());
lays = new OverlayType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
OverlayType type = new OverlayType(id);
type.decode(buffer);
lays[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading OverlayType(s)!", e);
}
logger.info("Loaded " + count + " OverlayType(s)!");
}
示例9: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.INV);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.INV).getData(), entry.size());
invs = new InvType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
InvType type = new InvType(id);
type.decode(buffer);
invs[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading InvType(s)!", e);
}
logger.info("Loaded " + count + " InvType(s)!");
}
示例10: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.SEQUENCE);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.SEQUENCE).getData(), entry.size());
seqs = new SequenceType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
SequenceType type = new SequenceType(id);
type.decode(buffer);
seqs[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading SequenceType(s)!", e);
}
logger.info("Loaded " + count + " SequenceType(s)!");
}
示例11: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.NPC);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.NPC).getData(), entry.size());
npcs = new NpcType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
NpcType type = new NpcType(id);
type.decode(buffer);
npcs[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading NpcType(s)!", e);
}
logger.info("Loaded " + count + " NpcType(s)!");
}
示例12: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.VARBIT);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.VARBIT).getData(), entry.size());
varBits = new VarBitType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
VarBitType type = new VarBitType(id);
type.decode(buffer);
varBits[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading VarBitType(s)!", e);
}
logger.info("Loaded " + count + " VarBitType(s)!");
}
示例13: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.SPOTANIM);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.SPOTANIM).getData(), entry.size());
spots = new SpotAnimType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
SpotAnimType type = new SpotAnimType(id);
type.decode(buffer);
spots[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading SpotAnimType(s)!", e);
}
logger.info("Loaded " + count + " SpotAnimType(s)!");
}
示例14: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.UNDERLAY);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.UNDERLAY).getData(), entry.size());
lays = new UnderlayType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
UnderlayType type = new UnderlayType(id);
type.decode(buffer);
lays[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading UnderlayType(s)!", e);
}
logger.info("Loaded " + count + " UnderlayType(s)!");
}
示例15: initialize
import net.openrs.cache.ReferenceTable; //导入方法依赖的package包/类
@Override
public void initialize(Cache cache) {
int count = 0;
try {
Container container = Container.decode(cache.getStore().read(CacheIndex.REFERENCE, CacheIndex.CONFIGS));
ReferenceTable table = ReferenceTable.decode(container.getData());
Entry entry = table.getEntry(ConfigArchive.ENUM);
Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.ENUM).getData(), entry.size());
enums = new EnumType[entry.capacity()];
for (int id = 0; id < entry.capacity(); id++) {
ChildEntry child = entry.getEntry(id);
if (child == null)
continue;
ByteBuffer buffer = archive.getEntry(child.index());
EnumType type = new EnumType(id);
type.decode(buffer);
enums[id] = type;
count++;
}
} catch (IOException e) {
logger.log(Level.SEVERE, "Error Loading EnumType(s)!", e);
}
logger.info("Loaded " + count + " EnumType(s)!");
}