本文整理汇总了Java中io.protostuff.LowCopyProtostuffOutput类的典型用法代码示例。如果您正苦于以下问题:Java LowCopyProtostuffOutput类的具体用法?Java LowCopyProtostuffOutput怎么用?Java LowCopyProtostuffOutput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LowCopyProtostuffOutput类属于io.protostuff包,在下文中一共展示了LowCopyProtostuffOutput类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import io.protostuff.LowCopyProtostuffOutput; //导入依赖的package包/类
@Override
public void serialize(RepositoryData repository, Buffer buffer) {
changeClassLoaderIfRequired();
ZeroCopyLinkBuffer zeroCopyLinkBuffer = linkedBuff.get();
LowCopyProtostuffOutput lowCopyProtostuffOutput = output.get();
zeroCopyLinkBuffer.withBuffer(buffer);
lowCopyProtostuffOutput.buffer = zeroCopyLinkBuffer;
try {
repoSchema.writeTo(lowCopyProtostuffOutput, repository);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例2: serializeObject
import io.protostuff.LowCopyProtostuffOutput; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void serializeObject(Buffer buffer, Object tc) {
ZeroCopyLinkBuffer zeroCopyLinkBuffer = linkedBuff.get();
LowCopyProtostuffOutput lowCopyProtostuffOutput = output.get();
zeroCopyLinkBuffer.withBuffer(buffer);
lowCopyProtostuffOutput.buffer = zeroCopyLinkBuffer;
long crc = crcNames.get(tc.getClass());
ProtoTransactionTypeHolder ptth = registeredCrc.get(crc);
if (ptth.crcCollision) {
byte[] key = sha1Names.get(tc.getClass());
ptth = registeredSha1.get(key);
buffer.writeByte(SHA1_TYPE);
buffer.writeBytes(key, 0, SHA1_DIGEST_SIZE);
} else {
buffer.writeByte(CRC32_TYPE);
buffer.writeLong(crc);
}
buffer.markSize();
Schema<Object> schema = (Schema<Object>) ptth.schema;
try {
schema.writeTo(lowCopyProtostuffOutput, tc);
} catch (IOException e) {
throw new RuntimeException(e);
}
buffer.writeSize();
}
示例3: addLengthPrependedEntryBuffersToList
import io.protostuff.LowCopyProtostuffOutput; //导入依赖的package包/类
private static void addLengthPrependedEntryBuffersToList(RegionWalEntry entry, List<ByteBuffer> buffers)
throws IOException {
LinkBuffer entryBuffer = new LinkBuffer();
LowCopyProtostuffOutput lcpo = new LowCopyProtostuffOutput(entryBuffer);
RegionWalEntry.getSchema().writeTo(lcpo, entry);
final int length = Ints.checkedCast(lcpo.buffer.size());
final LinkBuffer lengthBuf = new LinkBuffer().writeVarInt32(length);
buffers.addAll(lengthBuf.finish());
buffers.addAll(entryBuffer.finish());
}
示例4: initialValue
import io.protostuff.LowCopyProtostuffOutput; //导入依赖的package包/类
protected LowCopyProtostuffOutput initialValue() {
return new LowCopyProtostuffOutput();
}