当前位置: 首页>>代码示例>>Java>>正文


Java Cache类代码示例

本文整理汇总了Java中net.openrs.cache.Cache的典型用法代码示例。如果您正苦于以下问题:Java Cache类的具体用法?Java Cache怎么用?Java Cache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Cache类属于net.openrs.cache包,在下文中一共展示了Cache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import net.openrs.cache.Cache; //导入依赖的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();
		}
	}
}
 
开发者ID:jordanabrahambaws,项目名称:Quavo,代码行数:20,代码来源:ModelDumper.java

示例2: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
public static void initialize(Cache cache) {
	enm.initialize(cache);
	ident.initialize(cache);
	inv.initialize(cache);
	item.initialize(cache);
	npc.initialize(cache);
	obj.initialize(cache);
	over.initialize(cache);
	seq.initialize(cache);
	spot.initialize(cache);
	under.initialize(cache);
	varbit.initialize(cache);
	varc.initialize(cache);
	varcstr.initialize(cache);
	varp.initialize(cache);
}
 
开发者ID:jordanabrahambaws,项目名称:Quavo,代码行数:17,代码来源:TypeListManager.java

示例3: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.MODELS);
		models = new Model[table.capacity()];
		for (int id = 0; id < table.capacity(); id++) {
			Entry entry = table.getEntry(id);
			if (entry == null)
				continue;

			Container mContainer = cache.read(CacheIndex.MODELS, entry.index());
			ByteBuffer buffer = mContainer.getData();
			
			Model model = new Model(id);
			model.decode(buffer);
			models[id] = model;
			count++;
		}
	} catch (IOException e) {
		logger.log(Level.SEVERE, "Error Loading Model(s)!", e);
	}
	logger.info("Loaded " + count + " Model(s)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:24,代码来源:ModelList.java

示例4: main

import net.openrs.cache.Cache; //导入依赖的package包/类
public static void main(String[] args)
{
	long ms = System.currentTimeMillis();
	MapImageDumper dumper = new MapImageDumper();

	try (Cache cache = new Cache(FileStore.open(Constants.CACHE_PATH)))
	{
		dumper.initialize(cache);
		dumper.draw();
	}
	
	catch (Exception e)
	{
		e.printStackTrace();
	}
	System.out.println(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - ms));
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:18,代码来源:MapImageDumper.java

示例5: main

import net.openrs.cache.Cache; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	try (Cache in = new Cache(FileStore.open(Constants.CACHE_PATH));
			Cache out = new Cache(FileStore.create(Constants.CACHETMP_PATH, in.getTypeCount()))) {
		for (int type = 0; type < in.getTypeCount(); type++) {
			ByteBuffer buf = in.getStore().read(255, type);
			buf.mark();
			out.getStore().write(255, type, buf);
			buf.reset();

			ReferenceTable rt = in.getReferenceTable(type);
			for (int file = 0; file < rt.capacity(); file++) {
				if (rt.getEntry(file) == null) {
					System.out.println(type + ", " + file);
					continue;
				}

				out.getStore().write(type, file, in.getStore().read(type, file));
			}
		}
	}
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:22,代码来源:CacheDefragmenter.java

示例6: main

import net.openrs.cache.Cache; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
	try (Cache otherCache = new Cache(FileStore.open(Constants.CACHEO_PATH));
			Cache cache = new Cache(FileStore.open(Constants.CACHE_PATH))) {
		for (int type = 0; type < cache.getFileCount(255); type++) {
			ReferenceTable otherTable = otherCache.getReferenceTable(type);
			ReferenceTable table = cache.getReferenceTable(type);
			for (int file = 0; file < table.capacity(); file++) {
				Entry entry = table.getEntry(file);
				if (entry == null)
					continue;

				if (isRepackingRequired(cache, entry, type, file)) {
					Entry otherEntry = otherTable.getEntry(file);
					if (entry.getVersion() == otherEntry.getVersion() && entry.getCrc() == otherEntry.getCrc()) {
						cache.getStore().write(type, file, otherCache.getStore().read(type, file));
					}
				}
			}
		}
	}
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:22,代码来源:CacheAggregator.java

示例7: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		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)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:27,代码来源:VarClientTypeList.java

示例8: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		Entry entry = table.getEntry(ConfigArchive.AREA);
		Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.AREA).getData(),
				entry.size());

		areas = new AreaType[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());
			AreaType type = new AreaType(id);
			type.decode(buffer);
			areas[id] = type;
			count++;
		}
	} catch (IOException e) {
		logger.log(Level.SEVERE, "Error Loading AreaType(s)!", e);
	}
	logger.info("Loaded " + count + " AreaType(s)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:27,代码来源:AreaTypeList.java

示例9: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		Entry entry = table.getEntry(ConfigArchive.PARAMS);
		Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.PARAMS).getData(),
				entry.size());

		params = new ParamType[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());
			ParamType type = new ParamType(id);
			type.decode(buffer);
			params[id] = type;
			count++;
		}
	} catch (IOException e) {
		logger.log(Level.SEVERE, "Error Loading ParamType(s)!", e);
	}
	logger.info("Loaded " + count + " ParamType(s)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:27,代码来源:ParamTypeList.java

示例10: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		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)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:27,代码来源:ObjectTypeList.java

示例11: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		Entry entry = table.getEntry(ConfigArchive.HITBAR);
		Archive archive = Archive.decode(cache.read(CacheIndex.CONFIGS, ConfigArchive.HITBAR).getData(),
				entry.size());

		hitbars = new HitBarType[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());
			HitBarType type = new HitBarType(id);
			type.decode(buffer);
			hitbars[id] = type;
			count++;
		}
	} catch (IOException e) {
		logger.log(Level.SEVERE, "Error Loading HitBarType(s)!", e);
	}
	logger.info("Loaded " + count + " HitBarType(s)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:27,代码来源:HitBarTypeList.java

示例12: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		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)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:27,代码来源:VarClientStringTypeList.java

示例13: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		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)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:27,代码来源:IdentkitTypeList.java

示例14: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		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)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:27,代码来源:OverlayTypeList.java

示例15: initialize

import net.openrs.cache.Cache; //导入依赖的package包/类
@Override
public void initialize(Cache cache) {
	int count = 0;
	try {
		ReferenceTable table = cache.getReferenceTable(CacheIndex.CONFIGS);
		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)!");
}
 
开发者ID:kfricilone,项目名称:OpenRS,代码行数:26,代码来源:InvTypeList.java


注:本文中的net.openrs.cache.Cache类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。