当前位置: 首页>>代码示例>>Java>>正文


Java ByteBufferUtil.readBytesWithShortLength方法代码示例

本文整理汇总了Java中org.apache.cassandra.utils.ByteBufferUtil.readBytesWithShortLength方法的典型用法代码示例。如果您正苦于以下问题:Java ByteBufferUtil.readBytesWithShortLength方法的具体用法?Java ByteBufferUtil.readBytesWithShortLength怎么用?Java ByteBufferUtil.readBytesWithShortLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.utils.ByteBufferUtil的用法示例。


在下文中一共展示了ByteBufferUtil.readBytesWithShortLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: split

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
@Override
public ByteBuffer[] split(ByteBuffer name)
{
    // Assume all components, we'll trunk the array afterwards if need be, but
    // most names will be complete.
    ByteBuffer[] l = new ByteBuffer[types.size()];
    ByteBuffer bb = name.duplicate();
    readStatic(bb);
    int i = 0;
    while (bb.remaining() > 0)
    {
        l[i++] = ByteBufferUtil.readBytesWithShortLength(bb);
        bb.get(); // skip end-of-component
    }
    return i == l.length ? l : Arrays.copyOfRange(l, 0, i);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:17,代码来源:CompositeType.java

示例2: extractComponent

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public static ByteBuffer extractComponent(ByteBuffer bb, int idx)
{
    bb = bb.duplicate();
    readStatic(bb);
    int i = 0;
    while (bb.remaining() > 0)
    {
        ByteBuffer c = ByteBufferUtil.readBytesWithShortLength(bb);
        if (i == idx)
            return c;

        bb.get(); // skip end-of-component
        ++i;
    }
    return null;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:17,代码来源:CompositeType.java

示例3: getString

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public String getString(ByteBuffer bytes)
{
    StringBuilder sb = new StringBuilder();
    ByteBuffer bb = bytes.duplicate();
    readIsStatic(bb);

    int i = 0;
    while (bb.remaining() > 0)
    {
        if (bb.remaining() != bytes.remaining())
            sb.append(":");

        AbstractType<?> comparator = getAndAppendComparator(i, bb, sb);
        ByteBuffer value = ByteBufferUtil.readBytesWithShortLength(bb);

        sb.append(escape(comparator.getString(value)));

        byte b = bb.get();
        if (b != 0)
        {
            sb.append(b < 0 ? ":_" : ":!");
            break;
        }
        ++i;
    }
    return sb.toString();
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:28,代码来源:AbstractCompositeType.java

示例4: compareCustom

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public int compareCustom(ByteBuffer o1, ByteBuffer o2)
{
    if (!o1.hasRemaining() || !o2.hasRemaining())
        return o1.hasRemaining() ? 1 : o2.hasRemaining() ? -1 : 0;

    ByteBuffer bb1 = o1.duplicate();
    ByteBuffer bb2 = o2.duplicate();

    boolean isStatic1 = readIsStatic(bb1);
    boolean isStatic2 = readIsStatic(bb2);
    if (isStatic1 != isStatic2)
        return isStatic1 ? -1 : 1;

    int i = 0;

    ByteBuffer previous = null;

    while (bb1.remaining() > 0 && bb2.remaining() > 0)
    {
        AbstractType<?> comparator = getComparator(i, bb1, bb2);

        ByteBuffer value1 = ByteBufferUtil.readBytesWithShortLength(bb1);
        ByteBuffer value2 = ByteBufferUtil.readBytesWithShortLength(bb2);

        int cmp = comparator.compareCollectionMembers(value1, value2, previous);
        if (cmp != 0)
            return cmp;

        previous = value1;

        byte b1 = bb1.get();
        byte b2 = bb2.get();
        if (b1 != b2)
            return b1 - b2;

        ++i;
    }

    if (bb1.remaining() == 0)
        return bb2.remaining() == 0 ? 0 : -1;

    // bb1.remaining() > 0 && bb2.remaining() == 0
    return 1;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:45,代码来源:AbstractCompositeType.java


注:本文中的org.apache.cassandra.utils.ByteBufferUtil.readBytesWithShortLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。