本文整理了Java中com.vmware.xenon.common.Utils.getBuffer()
方法的一些代码示例,展示了Utils.getBuffer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.getBuffer()
方法的具体详情如下:
包路径:com.vmware.xenon.common.Utils
类名称:Utils
方法名:getBuffer
[英]See KryoSerializers#getBuffer(int)
[中]参见KryoSerializers#getBuffer(int)
代码示例来源:origin: vmware/xenon
private static ByteBuffer decompressGZip(ByteBuffer bb) throws Exception {
GZIPInputStream zis = new GZIPInputStream(new ByteBufferInputStream(bb));
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
byte[] buffer = Utils.getBuffer(1024);
int len;
while ((len = zis.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
} finally {
zis.close();
out.close();
}
return ByteBuffer.wrap(out.toByteArray());
}
代码示例来源:origin: vmware/xenon
@Test
public void toBytes() {
final int expectedByteCount = 115;
int count = 100000;
ServiceDocument s = buildCloneOrSerializationObject();
int byteCount = 0;
long start = System.nanoTime() / 1000;
for (int i = 0; i < count; i++) {
byte[] content = Utils.getBuffer(1024);
byteCount = Utils.toBytes(s, content, 0);
assertTrue(content != null);
assertTrue(content.length >= expectedByteCount);
}
long end = System.nanoTime() / 1000;
double thpt = end - start;
thpt /= 1000000;
thpt = count / thpt;
Logger.getAnonymousLogger().info(
String.format(
"Binary serializations per second: %f, iterations: %d, byte count: %d",
thpt, count, byteCount));
this.testResults.getReport().lastValue(TestResults.KEY_THROUGHPUT, thpt);
}
代码示例来源:origin: com.vmware.xenon/xenon-common
@Test
public void toBytes() {
final int expectedByteCount = 115;
int count = 100000;
ServiceDocument s = buildCloneOrSerializationObject();
int byteCount = 0;
long start = System.nanoTime() / 1000;
for (int i = 0; i < count; i++) {
byte[] content = Utils.getBuffer(1024);
byteCount = Utils.toBytes(s, content, 0);
assertTrue(content != null);
assertTrue(content.length >= expectedByteCount);
}
long end = System.nanoTime() / 1000;
double thpt = end - start;
thpt /= 1000000;
thpt = count / thpt;
Logger.getAnonymousLogger().info(
String.format(
"Binary serializations per second: %f, iterations: %d, byte count: %d",
thpt, count, byteCount));
this.testResults.getReport().lastValue(TestResults.KEY_THROUGHPUT, thpt);
}
代码示例来源:origin: vmware/xenon
int byteCountToObjectDefault = Utils.toBytes(st, Utils.getBuffer(1024), 0);
Output outDocumentImplicitDefault = KryoSerializers.serializeAsDocument(st,
1024);
代码示例来源:origin: com.vmware.xenon/xenon-common
int byteCountToObjectDefault = Utils.toBytes(st, Utils.getBuffer(1024), 0);
Output outDocumentImplicitDefault = KryoSerializers.serializeAsDocument(st,
1024);
内容来源于网络,如有侵权,请联系作者删除!