本文整理汇总了Java中org.apache.cassandra.utils.ByteBufferUtil.writeWithShortLength方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufferUtil.writeWithShortLength方法的具体用法?Java ByteBufferUtil.writeWithShortLength怎么用?Java ByteBufferUtil.writeWithShortLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.utils.ByteBufferUtil
的用法示例。
在下文中一共展示了ByteBufferUtil.writeWithShortLength方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer build()
{
try (DataOutputBuffer out = new DataOutputBufferFixed(serializedSize))
{
if (isStatic)
out.writeShort(STATIC_MARKER);
for (int i = 0; i < components.size(); i++)
{
ByteBufferUtil.writeWithShortLength(components.get(i), out);
out.write(endOfComponents[i]);
}
return ByteBuffer.wrap(out.getData(), 0, out.getLength());
}
catch (IOException e)
{
throw new RuntimeException(e);
}
}
示例2: serialize
import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public void serialize(ColumnSubselection subSel, DataOutputPlus out, int version) throws IOException
{
ColumnDefinition column = subSel.column();
ByteBufferUtil.writeWithShortLength(column.name.bytes, out);
out.writeByte(subSel.kind().ordinal());
switch (subSel.kind())
{
case SLICE:
Slice slice = (Slice)subSel;
column.cellPathSerializer().serialize(slice.from, out);
column.cellPathSerializer().serialize(slice.to, out);
break;
case ELEMENT:
Element eltSelection = (Element)subSel;
column.cellPathSerializer().serialize(eltSelection.element, out);
break;
default:
throw new AssertionError();
}
}
示例3: append
import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public void append(DecoratedKey key, RowIndexEntry indexEntry, long dataEnd, ByteBuffer indexInfo) throws IOException
{
bf.add(key);
long indexStart = indexFile.position();
try
{
ByteBufferUtil.writeWithShortLength(key.getKey(), indexFile);
rowIndexEntrySerializer.serialize(indexEntry, indexFile, indexInfo);
}
catch (IOException e)
{
throw new FSWriteError(e, indexFile.getPath());
}
long indexEnd = indexFile.position();
if (logger.isTraceEnabled())
logger.trace("wrote index entry: {} at {}", indexEntry, indexStart);
summary.maybeAddEntry(key, indexStart, indexEnd, dataEnd);
}
示例4: writePartitionHeader
import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
private void writePartitionHeader(UnfilteredRowIterator iterator) throws IOException
{
ByteBufferUtil.writeWithShortLength(iterator.partitionKey().getKey(), writer);
DeletionTime.serializer.serialize(iterator.partitionLevelDeletion(), writer);
if (header.hasStatic())
{
Row staticRow = iterator.staticRow();
UnfilteredSerializer.serializer.serializeStaticRow(staticRow, header, writer, version);
if (!observers.isEmpty())
observers.forEach((o) -> o.nextUnfilteredCluster(staticRow));
}
}
示例5: serialize
import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public void serialize(PartitionPosition pos, DataOutputPlus out, int version) throws IOException
{
Kind kind = pos.kind();
out.writeByte(kind.ordinal());
if (kind == Kind.ROW_KEY)
ByteBufferUtil.writeWithShortLength(((DecoratedKey)pos).getKey(), out);
else
Token.serializer.serialize(pos.getToken(), out, version);
}