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


Java ByteBufferUtil.EMPTY_BYTE_BUFFER属性代码示例

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


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

示例1: fromString

public ByteBuffer fromString(String source) throws MarshalException
{
    // Return an empty ByteBuffer for an empty string.
    if (source.isEmpty())
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;

    long longType;

    try
    {
        longType = Long.parseLong(source);
    }
    catch (Exception e)
    {
        throw new MarshalException(String.format("Unable to make long from '%s'", source), e);
    }

    return decompose(longType);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:19,代码来源:LongType.java

示例2: fromString

public ByteBuffer fromString(String source) throws MarshalException
{
    // Return an empty ByteBuffer for an empty string.
    if (source.isEmpty())
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;

    byte b;

    try
    {
        b = Byte.parseByte(source);
    }
    catch (Exception e)
    {
        throw new MarshalException(String.format("Unable to make byte from '%s'", source), e);
    }

    return decompose(b);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:19,代码来源:ByteType.java

示例3: fromString

public ByteBuffer fromString(String source) throws MarshalException
{
  // Return an empty ByteBuffer for an empty string.
  if (source.isEmpty())
      return ByteBufferUtil.EMPTY_BYTE_BUFFER;

  try
  {
      float f = Float.parseFloat(source);
      return ByteBufferUtil.bytes(f);
  }
  catch (NumberFormatException e1)
  {
      throw new MarshalException(String.format("Unable to make float from '%s'", source), e1);
  }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:16,代码来源:FloatType.java

示例4: parse

static ByteBuffer parse(String source)
{
    if (source.isEmpty())
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;

    if (regexPattern.matcher(source).matches())
    {
        try
        {
            return UUIDGen.toByteBuffer(UUID.fromString(source));
        }
        catch (IllegalArgumentException e)
        {
            throw new MarshalException(String.format("Unable to make UUID from '%s'", source), e);
        }
    }

    return null;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:19,代码来源:UUIDType.java

示例5: serialize

public ByteBuffer serialize(BigDecimal value)
{
    if (value == null)
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;

    BigInteger bi = value.unscaledValue();
    int scale = value.scale();
    byte[] bibytes = bi.toByteArray();

    ByteBuffer bytes = ByteBuffer.allocate(4 + bibytes.length);
    bytes.putInt(scale);
    bytes.put(bibytes);
    bytes.rewind();
    return bytes;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:15,代码来源:DecimalSerializer.java

示例6: fromJSONObject

@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
    if (!(parsed instanceof String))
        throw new MarshalException(String.format("Expected an empty string, but got: %s", parsed));
    if (!((String) parsed).isEmpty())
        throw new MarshalException(String.format("'%s' is not empty", parsed));

    return new Constants.Value(ByteBufferUtil.EMPTY_BYTE_BUFFER);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:10,代码来源:EmptyType.java

示例7: buildAsEndOfRange

public ByteBuffer buildAsEndOfRange()
{
    if (components.isEmpty())
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;

    ByteBuffer bb = build();
    bb.put(bb.remaining() - 1, (byte)1);
    return bb;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:9,代码来源:CompositeType.java

示例8: fromString

public ByteBuffer fromString(String source) throws MarshalException
{
    // Return an empty ByteBuffer for an empty string.
    if (source.isEmpty())
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;

    return decompose(Duration.from(source));
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:8,代码来源:DurationType.java

示例9: fromString

public ByteBuffer fromString(String source) throws MarshalException
{
    // Return an empty ByteBuffer for an empty string.
    if (source.isEmpty())
        return ByteBufferUtil.EMPTY_BYTE_BUFFER;

    try
    {
        return decompose(UUID.fromString(source));
    }
    catch (IllegalArgumentException e)
    {
        throw new MarshalException(String.format("unable to make UUID from '%s'", source), e);
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:15,代码来源:LexicalUUIDType.java

示例10: deserialize

public Cell deserialize(DataInputPlus in, LivenessInfo rowLiveness, ColumnDefinition column, SerializationHeader header, SerializationHelper helper) throws IOException
{
    int flags = in.readUnsignedByte();
    boolean hasValue = (flags & HAS_EMPTY_VALUE_MASK) == 0;
    boolean isDeleted = (flags & IS_DELETED_MASK) != 0;
    boolean isExpiring = (flags & IS_EXPIRING_MASK) != 0;
    boolean useRowTimestamp = (flags & USE_ROW_TIMESTAMP_MASK) != 0;
    boolean useRowTTL = (flags & USE_ROW_TTL_MASK) != 0;

    long timestamp = useRowTimestamp ? rowLiveness.timestamp() : header.readTimestamp(in);

    int localDeletionTime = useRowTTL
                            ? rowLiveness.localExpirationTime()
                            : (isDeleted || isExpiring ? header.readLocalDeletionTime(in) : NO_DELETION_TIME);

    int ttl = useRowTTL ? rowLiveness.ttl() : (isExpiring ? header.readTTL(in) : NO_TTL);

    CellPath path = column.isComplex()
                    ? column.cellPathSerializer().deserialize(in)
                    : null;

    ByteBuffer value = ByteBufferUtil.EMPTY_BYTE_BUFFER;
    if (hasValue)
    {
        if (helper.canSkipValue(column) || (path != null && helper.canSkipValue(path)))
        {
            header.getType(column).skipValue(in);
        }
        else
        {
            boolean isCounter = localDeletionTime == NO_DELETION_TIME && column.type.isCounter();

            value = header.getType(column).readValue(in, DatabaseDescriptor.getMaxValueSize());
            if (isCounter)
                value = helper.maybeClearCounterValue(value);
        }
    }

    return new BufferCell(column, timestamp, ttl, localDeletionTime, value, path);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:40,代码来源:Cell.java

示例11: getMinimumToken

public LocalToken getMinimumToken()
{
    return new LocalToken(ByteBufferUtil.EMPTY_BYTE_BUFFER);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:4,代码来源:LocalPartitioner.java

示例12: serialize

public ByteBuffer serialize(Double value)
{
    return (value == null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:4,代码来源:DoubleSerializer.java

示例13: serialize

public ByteBuffer serialize(Long value)
{
    return value == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:4,代码来源:LongSerializer.java

示例14: serialize

public ByteBuffer serialize(Short value)
{
    return value == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value.shortValue());
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:4,代码来源:ShortSerializer.java

示例15: serialize

public ByteBuffer serialize(UUID value)
{
    return value == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : UUIDGen.toByteBuffer(value);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:4,代码来源:UUIDSerializer.java


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