本文整理汇总了Java中org.apache.cassandra.io.util.DataOutputPlus.write方法的典型用法代码示例。如果您正苦于以下问题:Java DataOutputPlus.write方法的具体用法?Java DataOutputPlus.write怎么用?Java DataOutputPlus.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.io.util.DataOutputPlus
的用法示例。
在下文中一共展示了DataOutputPlus.write方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
void serialize(DataOutputPlus out) throws IOException
{
CRC32 crc = new CRC32();
out.writeInt(version);
updateChecksumInt(crc, version);
out.writeLong(timestamp);
updateChecksumLong(crc, timestamp);
out.writeLong(hostId.getMostSignificantBits());
updateChecksumLong(crc, hostId.getMostSignificantBits());
out.writeLong(hostId.getLeastSignificantBits());
updateChecksumLong(crc, hostId.getLeastSignificantBits());
byte[] paramsBytes = JSONValue.toJSONString(parameters).getBytes(StandardCharsets.UTF_8);
out.writeInt(paramsBytes.length);
updateChecksumInt(crc, paramsBytes.length);
out.writeInt((int) crc.getValue());
out.write(paramsBytes);
crc.update(paramsBytes, 0, paramsBytes.length);
out.writeInt((int) crc.getValue());
}
示例2: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public void serialize(Inner inner, DataOutputPlus out, int version) throws IOException
{
if (version < MessagingService.VERSION_30)
{
if (inner.hash == null)
out.writeInt(-1);
else
{
out.writeInt(inner.hash.length);
out.write(inner.hash);
}
}
Token.serializer.serialize(inner.token, out, version);
Hashable.serializer.serialize(inner.lchild, out, version);
Hashable.serializer.serialize(inner.rchild, out, version);
}
示例3: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public void serialize(KeyCacheKey key, DataOutputPlus out, ColumnFamilyStore cfs) throws IOException
{
//Don't serialize old format entries since we didn't bother to implement serialization of both for simplicity
//https://issues.apache.org/jira/browse/CASSANDRA-10778
if (!key.desc.version.storeRows()) return;
RowIndexEntry entry = CacheService.instance.keyCache.getInternal(key);
if (entry == null)
return;
out.write(cfs.metadata.ksAndCFBytes);
ByteBufferUtil.writeWithLength(key.key, out);
out.writeInt(key.desc.generation);
out.writeBoolean(true);
key.desc.getFormat().getIndexSerializer(cfs.metadata, key.desc.version, SerializationHeader.forKeyCache(cfs.metadata)).serialize(entry, out);
}
示例4: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
@Override
public void serialize(DataOutputPlus out, IndexInfo.Serializer idxInfoSerializer, ByteBuffer indexInfo) throws IOException
{
out.writeUnsignedVInt(position);
out.writeUnsignedVInt(fieldsSerializedSize + indexInfo.limit());
out.writeUnsignedVInt(headerLength);
DeletionTime.serializer.serialize(deletionTime, out);
out.writeUnsignedVInt(columnsIndexCount);
out.write(indexInfo);
}
示例5: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public void serialize(Inner inner, DataOutputPlus out, int version) throws IOException
{
if (inner.hash == null)
out.writeInt(-1);
else
{
out.writeInt(inner.hash.length);
out.write(inner.hash);
}
Token.serializer.serialize(inner.token, out);
Hashable.serializer.serialize(inner.lchild, out, version);
Hashable.serializer.serialize(inner.rchild, out, version);
}
示例6: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public void serialize(ReadResponse response, DataOutputPlus out, int version) throws IOException
{
out.writeInt(response.isDigestQuery() ? response.digest().remaining() : 0);
ByteBuffer buffer = response.isDigestQuery() ? response.digest() : ByteBufferUtil.EMPTY_BYTE_BUFFER;
out.write(buffer);
out.writeBoolean(response.isDigestQuery());
if (!response.isDigestQuery())
Row.serializer.serialize(response.row(), out, version);
}
示例7: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public void serialize(IndexSummary t, DataOutputPlus out, boolean withSamplingLevel) throws IOException
{
out.writeInt(t.minIndexInterval);
out.writeInt(t.offsetCount);
out.writeLong(t.getOffHeapSize());
if (withSamplingLevel)
{
out.writeInt(t.samplingLevel);
out.writeInt(t.sizeAtFullSampling);
}
// our on-disk representation treats the offsets and the summary data as one contiguous structure,
// in which the offsets are based from the start of the structure. i.e., if the offsets occupy
// X bytes, the value of the first offset will be X. In memory we split the two regions up, so that
// the summary values are indexed from zero, so we apply a correction to the offsets when de/serializing.
// In this case adding X to each of the offsets.
int baseOffset = t.offsetCount * 4;
for (int i = 0 ; i < t.offsetCount ; i++)
{
int offset = t.offsets.getInt(i * 4) + baseOffset;
// our serialization format for this file uses native byte order, so if this is different to the
// default Java serialization order (BIG_ENDIAN) we have to reverse our bytes
if (ByteOrder.nativeOrder() != ByteOrder.BIG_ENDIAN)
offset = Integer.reverseBytes(offset);
out.writeInt(offset);
}
out.write(t.entries, 0, t.entriesLength);
}
示例8: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public void serialize(EncodedHintMessage message, DataOutputPlus out, int version) throws IOException
{
if (version != message.version)
throw new IllegalArgumentException("serialize() called with non-matching version " + version);
UUIDSerializer.serializer.serialize(message.hostId, out, version);
out.writeUnsignedVInt(message.hint.remaining());
out.write(message.hint);
}
示例9: writeWithLength
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public static void writeWithLength(ByteBuffer bytes, DataOutputPlus out) throws IOException
{
out.writeInt(bytes.remaining());
out.write(bytes);
}
示例10: writeWithVIntLength
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public static void writeWithVIntLength(ByteBuffer bytes, DataOutputPlus out) throws IOException
{
out.writeUnsignedVInt(bytes.remaining());
out.write(bytes);
}
示例11: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
private void serialize(Row row, SerializationHeader header, DataOutputPlus out, long previousUnfilteredSize, int version)
throws IOException
{
int flags = 0;
int extendedFlags = 0;
boolean isStatic = row.isStatic();
Columns headerColumns = header.columns(isStatic);
LivenessInfo pkLiveness = row.primaryKeyLivenessInfo();
Row.Deletion deletion = row.deletion();
boolean hasComplexDeletion = row.hasComplexDeletion();
boolean hasAllColumns = (row.size() == headerColumns.size());
boolean hasExtendedFlags = hasExtendedFlags(row);
if (isStatic)
extendedFlags |= IS_STATIC;
if (!pkLiveness.isEmpty())
flags |= HAS_TIMESTAMP;
if (pkLiveness.isExpiring())
flags |= HAS_TTL;
if (!deletion.isLive())
{
flags |= HAS_DELETION;
if (deletion.isShadowable())
extendedFlags |= HAS_SHADOWABLE_DELETION;
}
if (hasComplexDeletion)
flags |= HAS_COMPLEX_DELETION;
if (hasAllColumns)
flags |= HAS_ALL_COLUMNS;
if (hasExtendedFlags)
flags |= EXTENSION_FLAG;
out.writeByte((byte)flags);
if (hasExtendedFlags)
out.writeByte((byte)extendedFlags);
if (!isStatic)
Clustering.serializer.serialize(row.clustering(), out, version, header.clusteringTypes());
if (header.isForSSTable())
{
try (DataOutputBuffer dob = DataOutputBuffer.scratchBuffer.get())
{
serializeRowBody(row, flags, header, dob);
out.writeUnsignedVInt(dob.position() + TypeSizes.sizeofUnsignedVInt(previousUnfilteredSize));
// We write the size of the previous unfiltered to make reverse queries more efficient (and simpler).
// This is currently not used however and using it is tbd.
out.writeUnsignedVInt(previousUnfilteredSize);
out.write(dob.getData(), 0, dob.getLength());
}
}
else
{
serializeRowBody(row, flags, header, out);
}
}
示例12: serialize
import org.apache.cassandra.io.util.DataOutputPlus; //导入方法依赖的package包/类
public void serialize(RepairMessage message, DataOutputPlus out, int version) throws IOException
{
out.write(message.messageType.type);
message.messageType.serializer.serialize(message, out, version);
}