本文整理汇总了Java中org.openyu.commons.lang.EncodingHelper类的典型用法代码示例。如果您正苦于以下问题:Java EncodingHelper类的具体用法?Java EncodingHelper怎么用?Java EncodingHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EncodingHelper类属于org.openyu.commons.lang包,在下文中一共展示了EncodingHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAuthKey
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Override
public AuthKey createAuthKey() {
AuthKey result = null;
StringBuilder uuid = new StringBuilder();
uuid.append(UUID.randomUUID().toString());
// 不加密,長度=36
StringBuilder buff = new StringBuilder();
//
if (isSecurity()) {
byte[] encrypt = securityProcessor.encrypt(ByteHelper.toByteArray(uuid.toString()));
//
// 加密後,長度=32
buff.append(EncodingHelper.encodeHex((encrypt)));
} else {
buff.append(uuid);
}
result = new AuthKeyImpl(buff.toString(), this.aliveMills);
return result;
}
示例2: deflaterBase64
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.38
public void deflaterBase64() 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";
byte[] encode = EncodingHelper.encodeBase64(value);// 1052
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelperWithoutPool.deflater(encode);
}
System.out.println("length: " + result.length);// 336
assertEquals(336, result.length);
}
示例3: inflaterBase64
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.13
public void inflaterBase64() 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";
byte[] encode = EncodingHelper.encodeBase64(value);// 1052
byte[] compress = CompressHelperWithoutPool.deflater(encode);
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelperWithoutPool.inflater(compress);
}
System.out.println("length: " + result.length);
assertTrue(Arrays.equals(encode, result));
}
示例4: 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);
}
示例5: 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 = CompressHelperWithoutPool.deflater(encode
.getBytes());
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelperWithoutPool.inflater(compress);
}
System.out.println("length: " + result.length);
assertTrue(Arrays.equals(encode.getBytes(), result));
}
示例6: gzipBase64
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.38
public void gzipBase64() 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";
byte[] encode = EncodingHelper.encodeBase64(value);// 1052
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelperWithoutPool.gzip(encode);
}
System.out.println("length: " + result.length);// 340
assertEquals(340, result.length);
}
示例7: ungzipBase64
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.13
public void ungzipBase64() 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";
byte[] encode = EncodingHelper.encodeBase64(value);// 1052
byte[] compress = CompressHelperWithoutPool.gzip(encode);
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelperWithoutPool.ungzip(compress);
}
System.out.println("length: " + result.length);
assertTrue(Arrays.equals(encode, result));
}
示例8: 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 = CompressHelperWithoutPool.gzip(encode.getBytes());
}
System.out.println("length: " + result.length);// 249
assertEquals(249, result.length);
}
示例9: 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 = CompressHelperWithoutPool.gzip(encode.getBytes());
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelperWithoutPool.ungzip(compress);
}
System.out.println("length: " + result.length);
assertEquals(1578, result.length);
assertTrue(Arrays.equals(encode.getBytes(), result));
}
示例10: deflateBase64
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.38
public void deflateBase64() 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";
byte[] encode = EncodingHelper.encodeBase64(value);// 1052
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelperWithoutPool.deflate(encode);
}
System.out.println("length: " + result.length);// 328
assertEquals(328, result.length);
}
示例11: inflateBase64
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.13
public void inflateBase64() 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";
byte[] encode = EncodingHelper.encodeBase64(value);// 1052
byte[] compress = CompressHelperWithoutPool.deflate(encode);
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelperWithoutPool.inflate(compress);
}
System.out.println("length: " + result.length);
assertTrue(Arrays.equals(encode, result));
}
示例12: deflateHex
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.37
public void deflateHex() 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.deflate(encode.getBytes());
}
System.out.println("length: " + result.length);// 237
assertEquals(237, result.length);
}
示例13: 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));
}
示例14: deflaterBase64
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.38
public void deflaterBase64() 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";
byte[] encode = EncodingHelper.encodeBase64(value);// 1052
//
byte[] result = null;
int count = 10000;
for (int i = 0; i < count; i++) {
result = CompressHelper.deflater(encode);
}
System.out.println("length: " + result.length);// 336
assertEquals(336, result.length);
}
示例15: inflaterBase64
import org.openyu.commons.lang.EncodingHelper; //导入依赖的package包/类
@Test
@BenchmarkOptions(benchmarkRounds = 3, warmupRounds = 2, concurrency = 1)
// round: 0.13
public void inflaterBase64() 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";
byte[] encode = EncodingHelper.encodeBase64(value);// 1052
byte[] compress = CompressHelper.deflater(encode);
//
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, result));
}