本文整理汇总了Java中org.apache.kylin.common.util.BytesSerializer类的典型用法代码示例。如果您正苦于以下问题:Java BytesSerializer类的具体用法?Java BytesSerializer怎么用?Java BytesSerializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BytesSerializer类属于org.apache.kylin.common.util包,在下文中一共展示了BytesSerializer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeGTScanReq
import org.apache.kylin.common.util.BytesSerializer; //导入依赖的package包/类
private ByteString serializeGTScanReq(GTScanRequest scanRequest) {
ByteString scanRequestByteString;
int scanRequestBufferSize = BytesSerializer.SERIALIZE_BUFFER_SIZE;
while (true) {
try {
ByteBuffer buffer = ByteBuffer.allocate(scanRequestBufferSize);
GTScanRequest.serializer.serialize(scanRequest, buffer);
buffer.flip();
scanRequestByteString = HBaseZeroCopyByteString.wrap(buffer.array(), buffer.position(), buffer.limit());
break;
} catch (BufferOverflowException boe) {
logger.info("Buffer size {} cannot hold the scan request, resizing to 4 times", scanRequestBufferSize);
scanRequestBufferSize *= 4;
}
}
return scanRequestByteString;
}
示例2: serializeRawScans
import org.apache.kylin.common.util.BytesSerializer; //导入依赖的package包/类
private ByteString serializeRawScans(List<RawScan> rawScans) {
ByteString rawScanByteString;
int rawScanBufferSize = BytesSerializer.SERIALIZE_BUFFER_SIZE;
while (true) {
try {
ByteBuffer rawScanBuffer = ByteBuffer.allocate(rawScanBufferSize);
BytesUtil.writeVInt(rawScans.size(), rawScanBuffer);
for (RawScan rs : rawScans) {
RawScan.serializer.serialize(rs, rawScanBuffer);
}
rawScanBuffer.flip();
rawScanByteString = HBaseZeroCopyByteString.wrap(rawScanBuffer.array(), rawScanBuffer.position(), rawScanBuffer.limit());
break;
} catch (BufferOverflowException boe) {
logger.info("Buffer size {} cannot hold the raw scans, resizing to 4 times", rawScanBufferSize);
rawScanBufferSize *= 4;
}
}
return rawScanByteString;
}
示例3: useDeserializedGTScanRequest
import org.apache.kylin.common.util.BytesSerializer; //导入依赖的package包/类
public static GTScanRequest useDeserializedGTScanRequest(GTScanRequest origin) {
ByteBuffer buffer = ByteBuffer.allocate(BytesSerializer.SERIALIZE_BUFFER_SIZE);
GTScanRequest.serializer.serialize(origin, buffer);
buffer.flip();
GTScanRequest sGTScanRequest = GTScanRequest.serializer.deserialize(buffer);
Assert.assertArrayEquals(origin.getAggrMetricsFuncs(), sGTScanRequest.getAggrMetricsFuncs());
Assert.assertEquals(origin.getAggCacheMemThreshold(), sGTScanRequest.getAggCacheMemThreshold(), 0.01);
return sGTScanRequest;
}
示例4: serialize
import org.apache.kylin.common.util.BytesSerializer; //导入依赖的package包/类
public static byte[] serialize(CoprocessorRowType o) {
ByteBuffer buf = ByteBuffer.allocate(BytesSerializer.SERIALIZE_BUFFER_SIZE);
serializer.serialize(o, buf);
byte[] result = new byte[buf.position()];
System.arraycopy(buf.array(), 0, result, 0, buf.position());
return result;
}
示例5: serialize
import org.apache.kylin.common.util.BytesSerializer; //导入依赖的package包/类
public static byte[] serialize(CoprocessorProjector o) {
ByteBuffer buf = ByteBuffer.allocate(BytesSerializer.SERIALIZE_BUFFER_SIZE);
serializer.serialize(o, buf);
byte[] result = new byte[buf.position()];
System.arraycopy(buf.array(), 0, result, 0, buf.position());
return result;
}