本文整理匯總了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();
}