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


Java EncodingHelper.encodeHex方法代码示例

本文整理汇总了Java中org.openyu.commons.lang.EncodingHelper.encodeHex方法的典型用法代码示例。如果您正苦于以下问题:Java EncodingHelper.encodeHex方法的具体用法?Java EncodingHelper.encodeHex怎么用?Java EncodingHelper.encodeHex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openyu.commons.lang.EncodingHelper的用法示例。


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

示例1: gzipHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.38
public void gzipHex() throws Exception {
	// 789
	String value = "Catalog||Games, movies & music||Music||Childrens,Catalog||Games, movies & music||Music||Jazz music,Catalog||Games, movies & music||Music||Blues music,Catalog||Games, movies & music||Video||Television: series,Catalog||Games, movies & music||Music||Folk music,Catalog||Games, movies & music||Video||Miscellaneous,Catalog||Games, movies & music||Music||Popular music,Catalog||Games, movies & music||Music||New age music,Catalog||Games, movies & music||Music||Original cast recordings,Catalog||Games, movies & music||Video||Westerns,Catalog||Games, movies & music||Video||Horror,Catalog||Games, movies & music||Music||Music video: latin,Catalog||Games, movies & music||Music||Classical music,Catalog||Games, movies & music||Music||World music,Catalog||Games, movies & music||Music||Electronica";
	String encode = EncodingHelper.encodeHex(value.getBytes());// 1578
	//
	byte[] result = null;
	int count = 10000;
	for (int i = 0; i < count; i++) {
		result = CompressHelper.gzip(encode.getBytes());
	}
	System.out.println("length: " + result.length);// 249
	assertEquals(249, result.length);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:17,代码来源:CompressHelperTest.java

示例2: inflaterHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.13
public void inflaterHex() throws Exception {
	// 789
	String value = "Catalog||Games, movies & music||Music||Childrens,Catalog||Games, movies & music||Music||Jazz music,Catalog||Games, movies & music||Music||Blues music,Catalog||Games, movies & music||Video||Television: series,Catalog||Games, movies & music||Music||Folk music,Catalog||Games, movies & music||Video||Miscellaneous,Catalog||Games, movies & music||Music||Popular music,Catalog||Games, movies & music||Music||New age music,Catalog||Games, movies & music||Music||Original cast recordings,Catalog||Games, movies & music||Video||Westerns,Catalog||Games, movies & music||Video||Horror,Catalog||Games, movies & music||Music||Music video: latin,Catalog||Games, movies & music||Music||Classical music,Catalog||Games, movies & music||Music||World music,Catalog||Games, movies & music||Music||Electronica";
	String encode = EncodingHelper.encodeHex(value);// 1578
	byte[] compress = CompressHelper.deflater(encode.getBytes());
	//
	byte[] result = null;
	int count = 10000;
	for (int i = 0; i < count; i++) {
		result = CompressHelper.inflater(compress);
	}
	System.out.println("length: " + result.length);
	assertTrue(Arrays.equals(encode.getBytes(), result));
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:18,代码来源:CompressHelperTest.java

示例3: ungzipHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.13
public void ungzipHex() throws Exception {
	// 789
	String value = "Catalog||Games, movies & music||Music||Childrens,Catalog||Games, movies & music||Music||Jazz music,Catalog||Games, movies & music||Music||Blues music,Catalog||Games, movies & music||Video||Television: series,Catalog||Games, movies & music||Music||Folk music,Catalog||Games, movies & music||Video||Miscellaneous,Catalog||Games, movies & music||Music||Popular music,Catalog||Games, movies & music||Music||New age music,Catalog||Games, movies & music||Music||Original cast recordings,Catalog||Games, movies & music||Video||Westerns,Catalog||Games, movies & music||Video||Horror,Catalog||Games, movies & music||Music||Music video: latin,Catalog||Games, movies & music||Music||Classical music,Catalog||Games, movies & music||Music||World music,Catalog||Games, movies & music||Music||Electronica";
	String encode = EncodingHelper.encodeHex(value);// 1578
	byte[] compress = CompressHelper.gzip(encode.getBytes());
	//
	byte[] result = null;
	int count = 10000;
	for (int i = 0; i < count; i++) {
		result = CompressHelper.ungzip(compress);
	}
	System.out.println("length: " + result.length);
	assertEquals(1578, result.length);
	assertTrue(Arrays.equals(encode.getBytes(), result));
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:19,代码来源:CompressHelperTest.java

示例4: inflateHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.13
public void inflateHex() throws Exception {
	// 789
	String value = "Catalog||Games, movies & music||Music||Childrens,Catalog||Games, movies & music||Music||Jazz music,Catalog||Games, movies & music||Music||Blues music,Catalog||Games, movies & music||Video||Television: series,Catalog||Games, movies & music||Music||Folk music,Catalog||Games, movies & music||Video||Miscellaneous,Catalog||Games, movies & music||Music||Popular music,Catalog||Games, movies & music||Music||New age music,Catalog||Games, movies & music||Music||Original cast recordings,Catalog||Games, movies & music||Video||Westerns,Catalog||Games, movies & music||Video||Horror,Catalog||Games, movies & music||Music||Music video: latin,Catalog||Games, movies & music||Music||Classical music,Catalog||Games, movies & music||Music||World music,Catalog||Games, movies & music||Music||Electronica";
	String encode = EncodingHelper.encodeHex(value);// 1578
	byte[] compress = CompressHelperWithoutPool.deflate(encode
			.getBytes());
	//
	byte[] result = null;
	int count = 1;
	for (int i = 0; i < count; i++) {
		result = CompressHelperWithoutPool.inflate(compress);
	}
	System.out.println("length: " + result.length);
	assertTrue(Arrays.equals(encode.getBytes(), result));
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:19,代码来源:CompressHelperWithoutPoolTest.java

示例5: deflaterHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.38
public void deflaterHex() throws Exception {
	// 789
	String value = "Catalog||Games, movies & music||Music||Childrens,Catalog||Games, movies & music||Music||Jazz music,Catalog||Games, movies & music||Music||Blues music,Catalog||Games, movies & music||Video||Television: series,Catalog||Games, movies & music||Music||Folk music,Catalog||Games, movies & music||Video||Miscellaneous,Catalog||Games, movies & music||Music||Popular music,Catalog||Games, movies & music||Music||New age music,Catalog||Games, movies & music||Music||Original cast recordings,Catalog||Games, movies & music||Video||Westerns,Catalog||Games, movies & music||Video||Horror,Catalog||Games, movies & music||Music||Music video: latin,Catalog||Games, movies & music||Music||Classical music,Catalog||Games, movies & music||Music||World music,Catalog||Games, movies & music||Music||Electronica";
	String encode = EncodingHelper.encodeHex(value.getBytes());// 1578
	//
	byte[] result = null;
	int count = 10000;
	for (int i = 0; i < count; i++) {
		result = CompressHelperWithoutPool.deflater(encode.getBytes());
	}
	System.out.println("length: " + result.length);// 266
	assertEquals(266, result.length);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:17,代码来源:CompressHelperWithoutPoolTest.java

示例6: ACCOUNT_AUTHORIZE_REQUEST

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
public void ACCOUNT_AUTHORIZE_REQUEST() {
	final String ACCOUNT_ID = "TEST_ACCOUNT_1";
	final String ASSIGN_KEY = "FarFarAway";
	final String ALGORITHM = "HmacMD5";
	// b5f01d3a0898d8016b5633edfe6106b0
	SecretKey secretKey = SecurityHelper.createSecretKey(ASSIGN_KEY,
			ALGORITHM);
	byte[] buff = SecurityHelper.mac("1111", secretKey, ALGORITHM);
	final String PASSWORD = EncodingHelper.encodeHex(buff);
	System.out.println(PASSWORD);
	//
	Message message = messageService.createClient(ACCOUNT_ID,
			CoreMessageType.ACCOUNT_AUTHORIZE_REQUEST);
	message.addString(ACCOUNT_ID);
	message.addString(PASSWORD);
	accountSocklet.service(message);
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:19,代码来源:AccountSockletTest.java

示例7: ACCOUNT_AUTHORIZE_REQUEST

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
public void ACCOUNT_AUTHORIZE_REQUEST() {
	final String ACCOUNT_ID = "TEST_ACCOUNT_1";
	final String ASSIGN_KEY = "FarFarAway";
	final String ALGORITHM = "HmacMD5";
	// b5f01d3a0898d8016b5633edfe6106b0
	SecretKey secretKey = SecurityHelper.createSecretKey(ASSIGN_KEY,
			ALGORITHM);
	byte[] buff = SecurityHelper.mac("1111", secretKey, ALGORITHM);
	final String PASSWORD = EncodingHelper.encodeHex(buff);
	System.out.println(PASSWORD);
	//
	Message message = messageService.createClient(ACCOUNT_ID,
			CoreMessageType.ACCOUNT_AUTHORIZE_REQUEST);
	message.addString(ACCOUNT_ID);
	message.addString(PASSWORD);
	//
	javaConnector.send(message);
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:20,代码来源:AccountSockletTest.java

示例8: authorize

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
public void authorize() {
	final String ACCOUNT_ID = "TEST_ACCOUNT_1";
	final String ASSIGN_KEY = "FarFarAway";
	final String ALGORITHM = "HmacMD5";
	SecretKey secretKey = SecurityHelper.createSecretKey(ASSIGN_KEY, ALGORITHM);
	byte[] buff = SecurityHelper.mac("1111", secretKey, ALGORITHM);
	final String PASSWORD = EncodingHelper.encodeHex(buff);
	System.out.println(PASSWORD);
	//
	accountService.authorize(ACCOUNT_ID, PASSWORD);
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:13,代码来源:AccountServiceImplTest.java

示例9: checkAccount

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
public void checkAccount() {
	final String ACCOUNT_ID = "TEST_ACCOUNT_1";
	// b5f01d3a0898d8016b5633edfe6106b0
	final String ASSIGN_KEY = "FarFarAway";
	final String ALGORITHM = "HmacMD5";
	SecretKey secretKey = SecurityHelper.createSecretKey(ASSIGN_KEY, ALGORITHM);
	byte[] buff = SecurityHelper.mac("1111", secretKey, ALGORITHM);
	final String PASSWORD = EncodingHelper.encodeHex(buff);
	System.out.println(PASSWORD);
	//
	String authKey = accountService.checkAccount(ACCOUNT_ID, PASSWORD);
	System.out.println(authKey);
}
 
开发者ID:mixaceh,项目名称:openyu-socklet,代码行数:15,代码来源:AccountServiceImplTest.java

示例10: authorize

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
public void authorize() {
	final String ACCOUNT_ID = "TEST_ACCOUNT_1";
	final String ASSIGN_KEY = "FarFarAway";
	final String ALGORITHM = "HmacMD5";
	// b5f01d3a0898d8016b5633edfe6106b0
	SecretKey secretKey = SecurityHelper.createSecretKey(ASSIGN_KEY, ALGORITHM);
	byte[] buff = SecurityHelper.mac("1111", secretKey, ALGORITHM);
	final String PASSWORD = EncodingHelper.encodeHex(buff);
	System.out.println(PASSWORD);
	//
	accountService.authorize(ACCOUNT_ID, PASSWORD);
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:14,代码来源:AccountServiceImplTest.java

示例11: checkAccount

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
public void checkAccount() {
	final String ACCOUNT_ID = "TEST_ACCOUNT_1";
	final String ASSIGN_KEY = "FarFarAway";
	final String ALGORITHM = "HmacMD5";
	// b5f01d3a0898d8016b5633edfe6106b0
	SecretKey secretKey = SecurityHelper.createSecretKey(ASSIGN_KEY, ALGORITHM);
	byte[] buff = SecurityHelper.mac("1111", secretKey, ALGORITHM);
	final String PASSWORD = EncodingHelper.encodeHex(buff);
	System.out.println(PASSWORD);
	//
	String authKey = accountService.checkAccount(ACCOUNT_ID, PASSWORD);
	System.out.println(authKey);//
}
 
开发者ID:mixaceh,项目名称:openyu-mix,代码行数:15,代码来源:AccountServiceImplTest.java

示例12: encryptDecryptHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
// 1000000 times: 13034 mills.
// 1000000 times: 13543 mills.
// 1000000 times: 11782 mills.
public void encryptDecryptHex() {
	String value = "中文測試abcdef";
	//
	String algorithm = "DES";
	SecretKey secretKey = SecurityHelper.randomSecretKey(algorithm);
	String keyFile = "encryptDecryptByHex";

	// 將key寫入檔案,給解密用
	String writeKeyFile = SecurityHelper.writeSecretKey(keyFile, secretKey);
	assertNotNull(writeKeyFile);
	//
	String encodeByHex = null;
	byte[] encrypt = null;
	int count = 1;
	long beg = System.currentTimeMillis();
	for (int i = 0; i < count; i++) {
		encrypt = SecurityHelper.encrypt(value, secretKey, algorithm);
		encodeByHex = EncodingHelper.encodeHex(encrypt);
	}
	long end = System.currentTimeMillis();
	System.out.println(count + " times: " + (end - beg) + " mills. ");

	System.out.println(encodeByHex.length() + ", " + encodeByHex);// 48,
																	// b824f54aa6cc7c0003afea7627c5c308b5e6842fcf6481cc
	//
	byte[] decodeByHex = EncodingHelper.decodeHex(encodeByHex);

	// 從檔案讀取key
	secretKey = SecurityHelper.readSecretKey(keyFile);
	assertNotNull(secretKey);
	//
	byte[] decrypt = SecurityHelper.decrypt(decodeByHex, secretKey, "DES");
	//
	String stringValue = ByteHelper.toString(decrypt);
	System.out.println(stringValue);// 中文測試abcdef
	assertEquals(value, stringValue);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:42,代码来源:SecurityHelperTest.java

示例13: encryptDecryptHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
@Test
// 1000000 times: 13034 mills.
// 1000000 times: 13543 mills.
// 1000000 times: 11782 mills.
public void encryptDecryptHex() {
	String value = "中文測試abcdef";
	//
	String algorithm = "DES";
	SecretKey secretKey = SecurityHelperWithoutPool
			.randomSecretKey(algorithm);
	String keyFile = "encryptDecryptByHex";

	// 將key寫入檔案,給解密用
	String writeKeyFile = SecurityHelperWithoutPool.writeSecretKey(keyFile,
			secretKey);
	assertNotNull(writeKeyFile);
	//
	String encodeByHex = null;
	byte[] encrypt = null;
	int count = 1;
	long beg = System.currentTimeMillis();
	for (int i = 0; i < count; i++) {
		encrypt = SecurityHelperWithoutPool.encrypt(value, secretKey,
				algorithm);
		encodeByHex = EncodingHelper.encodeHex(encrypt);
	}
	long end = System.currentTimeMillis();
	System.out.println(count + " times: " + (end - beg) + " mills. ");

	System.out.println(encodeByHex.length() + ", " + encodeByHex);// 48,
																	// b824f54aa6cc7c0003afea7627c5c308b5e6842fcf6481cc
	//
	byte[] decodeByHex = EncodingHelper.decodeHex(encodeByHex);

	// 從檔案讀取key
	secretKey = SecurityHelperWithoutPool.readSecretKey(keyFile);
	assertNotNull(secretKey);
	//
	byte[] decrypt = SecurityHelperWithoutPool.decrypt(decodeByHex,
			secretKey, "DES");
	//
	String stringValue = ByteHelper.toString(decrypt);
	System.out.println(stringValue);// 中文測試abcdef
	assertEquals(value, stringValue);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:46,代码来源:SecurityHelperWithoutPoolTest.java

示例14: encryptHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
/**
 * 對稱加密,傳回hex
 * 
 * @param value
 * @param secretKey
 * @param algorithm
 * @return
 */
public static String encryptHex(byte[] values, SecretKey secretKey, String algorithm) {
	byte[] buffs = encrypt(values, secretKey, algorithm);
	return EncodingHelper.encodeHex(buffs);
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:13,代码来源:SecurityHelperWithoutPool.java

示例15: crc32AsHex

import org.openyu.commons.lang.EncodingHelper; //导入方法依赖的package包/类
/**
 * crc32 as a hex string
 * 
 * @param value
 * @return
 */
public static String crc32AsHex(String value) {
	return EncodingHelper.encodeHex(ByteHelper.toByteArray(crc32(value)));
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:10,代码来源:ChecksumHelperWithoutPool.java


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