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


Java CompressType类代码示例

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


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

示例1: writeToXml

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void writeToXml() {
	CompressProcessor value = new CompressProcessorImpl();
	//
	value.setCompress(true);
	value.setCompressType(CompressType.LZ4);
	//
	String result = CollectorHelper.writeToXml(CompressProcessorImpl.class,
			value);
	System.out.println(result);
	assertNotNull(result);
	System.out.println(value.getCompressTypes());
	//
	CompressProcessor value2 = new CompressProcessorImpl();
	System.out.println(value2.getCompressTypes());
	assertTrue(value.getCompressTypes() == value2.getCompressTypes());
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:19,代码来源:CompressProcessorImplTest.java

示例2: unmarshal

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
public CompressType unmarshal(CompressTypeEntry value) throws Exception {
	CompressType result = null;
	//
	if (value != null) {
		result = CompressType.valueOf(value.key);
	}
	return result;
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:9,代码来源:CompressTypeXmlAdapter.java

示例3: marshal

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
public CompressTypeEntry marshal(CompressType value) throws Exception {
	CompressTypeEntry result = null;
	//
	if (value != null) {
		result = new CompressTypeEntry(value.name(), value.getValue());
	}
	return result;
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:9,代码来源:CompressTypeXmlAdapter.java

示例4: getCompressTypes

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
/**
 * 壓縮類別列舉
 * 
 * @return
 */
public Set<CompressType> getCompressTypes() {
	if (compressTypes == null) {
		compressTypes = new LinkedHashSet<CompressType>();
	}
	return compressTypes;
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:12,代码来源:CompressProcessorImpl.java

示例5: compress

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void compress() {
	CompressProcessor compressable = new CompressProcessorImpl();
	compressable.setCompress(true);
	compressable.setCompressType(CompressType.LZ4);
	//
	String stringValue = new String(new byte[307200]);
	byte[] value = ByteHelper.toByteArray(stringValue);
	//
	byte[] result = null;
	int count = 1000;
	long beg = System.currentTimeMillis();
	for (int i = 0; i < count; i++) {
		result = compressable.compress(7, value);
	}
	long end = System.currentTimeMillis();
	System.out.println(count + " times: " + (end - beg) + " mills. ");
	//
	System.out.println("length: " + result.length);// 1219
	assertEquals(1219, result.length);
	//
	result = compressable.compress("LZ4", value);
	System.out.println("length: " + result.length);// 1219
	assertEquals(1219, result.length);
	//
	result = compressable.compress(value);
	System.out.println("length: " + result.length);// 1219
	assertEquals(1219, result.length);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:31,代码来源:CompressProcessorImplTest.java

示例6: uncompress

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void uncompress() throws Exception {
	CompressProcessor compressable = new CompressProcessorImpl();
	compressable.setCompress(true);
	compressable.setCompressType(CompressType.LZ4);
	//
	String stringValue = new String(new byte[307200]);
	byte[] value = compressable.compress(ByteHelper
			.toByteArray(stringValue));
	//
	byte[] result = null;
	int count = 1000;
	long beg = System.currentTimeMillis();
	for (int i = 0; i < count; i++) {
		result = compressable.uncompress(7, value);
	}
	long end = System.currentTimeMillis();
	System.out.println(count + " times: " + (end - beg) + " mills. ");
	//
	System.out.println("length: " + result.length);
	assertEquals(307200, result.length);
	//
	result = compressable.uncompress("LZ4", value);
	System.out.println("length: " + result.length);
	assertEquals(307200, result.length);
	//
	result = compressable.uncompress(value);
	System.out.println("length: " + result.length);
	assertEquals(307200, result.length);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:32,代码来源:CompressProcessorImplTest.java

示例7: writeToXml

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
@Test
@Deprecated
/**
 * 只是為了模擬用,有正式xml後,不應再使用,以免覆蓋掉正式的xml
 */
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void writeToXml() {
	RoleCollector collector = RoleCollector.getInstance(false);
	String result = null;
	//
	collector.setRetryNumber(3);
	collector.setRetryPauseMills(1 * 1000L);
	collector.setUnsaveDir("custom/role/unsave");
	collector.setListenMills(3 * 60 * 1000L);// 3分鐘
	//
	collector.getSerializeProcessor().setSerialize(true);
	collector.getSerializeProcessor().setSerializeType(SerializeType.FST);
	//
	collector.getSecurityProcessor().setSecurity(true);
	collector.getSecurityProcessor().setSecurityType(SecurityType.AES_ECB_PKCS5Padding);
	collector.getSecurityProcessor().setSecurityKey("Girls, LongTimeNoSee");
	//
	collector.getCompressProcessor().setCompress(true);
	collector.getCompressProcessor().setCompressType(CompressType.SNAPPY);
	//
	result = CollectorHelper.writeToXml(RoleCollector.class, collector);
	//
	System.out.println(result);
	assertNotNull(result);
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:31,代码来源:RoleCollectorTest.java

示例8: writeToXml

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
@Test
@Deprecated
/**
 * 只是為了模擬用,有正式xml後,不應再使用,以免覆蓋掉正式的xml
 */
@BenchmarkOptions(benchmarkRounds = 1, warmupRounds = 0, concurrency = 1)
public void writeToXml() {
	String result = null;
	ChatCollector collector = ChatCollector.getInstance(false);
	//
	collector.setRetryNumber(3);
	collector.setRetryPauseMills(1 * 1000L);
	collector.setUnsaveDir("custom/chat/unsave");
	collector.setListenMills(3 * 60 * 1000L + 10000L);// 3分鐘又10秒
	//
	//
	collector.getSerializeProcessor().setSerialize(true);
	collector.getSerializeProcessor().setSerializeType(SerializeType.FST);
	//
	collector.getSecurityProcessor().setSecurity(true);
	collector.getSecurityProcessor().setSecurityType(SecurityType.AES_ECB_PKCS5Padding);
	collector.getSecurityProcessor().setSecurityKey("Girls, LongTimeNoSee");
	//
	collector.getCompressProcessor().setCompress(true);
	collector.getCompressProcessor().setCompressType(CompressType.SNAPPY);
	//
	result = CollectorHelper.writeToXml(ChatCollector.class, collector);
	//
	System.out.println(result);
	assertNotNull(result);
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:32,代码来源:ChatCollectorTest.java

示例9: setCompressType

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
public void setCompressType(CompressType compressType) {
	this.compressType = compressType;
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:4,代码来源:CompressProcessorImpl.java

示例10: setCompressTypes

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
public void setCompressTypes(Set<CompressType> compressTypes) {
	CompressProcessorImpl.compressTypes = compressTypes;
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:4,代码来源:CompressProcessorImpl.java

示例11: setCompressType

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
public void setCompressType(CompressType compressType) {
	compressable.setCompressType(compressType);
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:4,代码来源:ProtocolServiceImplBak.java

示例12: setCompressTypes

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
public void setCompressTypes(Set<CompressType> compressTypes) {
	compressable.setCompressTypes(compressTypes);
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:4,代码来源:ProtocolServiceImplBak.java

示例13: setCompressType

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
public void setCompressType(CompressType compressType) {
	compressProcessor.setCompressType(compressType);
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:4,代码来源:ProtocolServiceImplBak2.java

示例14: createService

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
/**
 * 建構
 * 
 * @return
 */
protected ProtocolService createService() throws Exception {
	ProtocolServiceImpl result = null;
	try {
		result = new ProtocolServiceImpl();
		//
		result.setApplicationContext(applicationContext);
		result.setBeanFactory(beanFactory);
		result.setResourceLoader(resourceLoader);
		//
		result.setCreateInstance(true);

		/**
		 * extendedProperties
		 */
		// checksum
		result.setChecksum(extendedProperties.getBoolean(CHECKSUM, DEFAULT_CHECKSUM));
		String checksumTypeValue = extendedProperties.getString(CHECKSUM_TYPE, DEFAULT_CHECKSUM_TYPE.name());
		ChecksumType checksumType = EnumHelper.valueOf(ChecksumType.class, checksumTypeValue);
		result.setChecksumType(checksumType);
		result.setChecksumKey(extendedProperties.getString(CHECKSUM_KEY, DEFAULT_CHECKSUM_KEY));

		// security
		result.setSecurity(extendedProperties.getBoolean(SECURITY, DEFAULT_SECURITY));
		String securityTypeValue = extendedProperties.getString(SECURITY_TYPE, DEFAULT_SECURITY_TYPE.getValue());
		SecurityType securityType = EnumHelper.valueOf(SecurityType.class, securityTypeValue);
		result.setSecurityType(securityType);
		result.setSecurityKey(extendedProperties.getString(SECURITY_KEY, DEFAULT_SECURITY_KEY));

		// compress
		result.setCompress(extendedProperties.getBoolean(COMPRESS, DEFAULT_COMPRESS));
		String compressTypeValue = extendedProperties.getString(COMPRESS_TYPE, DEFAULT_COMPRESS_TYPE.name());
		CompressType compressType = EnumHelper.valueOf(CompressType.class, compressTypeValue);
		result.setCompressType(compressType);

		/**
		 * injectiion
		 */

		// 啟動
		result.start();
	} catch (Exception e) {
		LOGGER.error(new StringBuilder("Exception encountered during createService()").toString(), e);
		try {
			result = (ProtocolServiceImpl) shutdownService();
		} catch (Exception e2) {
			throw e2;
		}
		throw e;
	}
	return result;
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:57,代码来源:ProtocolServiceFactoryBean.java

示例15: compress

import org.openyu.commons.util.CompressType; //导入依赖的package包/类
/**
 * 壓縮
 * 
 * @param compressTypeValue
 *            壓縮類別
 * @see CompressType
 * @param value
 * @return
 */
public byte[] compress(String compressTypeValue, byte[] value) {
	CompressType compressType = EnumHelper.valueOf(CompressType.class, compressTypeValue);
	AssertHelper.notNull(compressType, "The CompressType must not be null");
	this.compressType = compressType;
	return compress(value);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:16,代码来源:CompressProcessorImpl.java


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