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


Java ByteBufferUtil.bytes方法代码示例

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


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

示例1: fromJSONObject

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
@Override
public Term fromJSONObject(Object parsed) throws MarshalException
{
    if (parsed instanceof Long)
        return new Constants.Value(ByteBufferUtil.bytes((Long) parsed));

    try
    {
        return new Constants.Value(TimestampType.instance.fromString((String) parsed));
    }
    catch (ClassCastException exc)
    {
        throw new MarshalException(String.format(
                "Expected a long or a datestring representation of a date value, but got a %s: %s",
                parsed.getClass().getSimpleName(), parsed));
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:18,代码来源:DateType.java

示例2: fromString

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
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,代码行数:17,代码来源:FloatType.java

示例3: getIdentifier

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ColumnIdentifier getIdentifier(CFMetaData cfm)
{
    if (!cfm.isStaticCompactTable())
        return ColumnIdentifier.getInterned(text, true);

    AbstractType<?> thriftColumnNameType = cfm.thriftColumnNameType();
    if (thriftColumnNameType instanceof UTF8Type)
        return ColumnIdentifier.getInterned(text, true);

    // We have a Thrift-created table with a non-text comparator. Check if we have a match column, otherwise assume we should use
    // thriftColumnNameType
    ByteBuffer bufferName = ByteBufferUtil.bytes(text);
    for (ColumnDefinition def : cfm.allColumns())
    {
        if (def.name.bytes.equals(bufferName))
            return def.name;
    }
    return ColumnIdentifier.getInterned(thriftColumnNameType, thriftColumnNameType.fromString(text), text);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:20,代码来源:ColumnDefinition.java

示例4: prepare

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ColumnDefinition prepare(CFMetaData cfm)
{
    if (!cfm.isStaticCompactTable())
        return find(cfm);

    AbstractType<?> thriftColumnNameType = cfm.thriftColumnNameType();
    if (thriftColumnNameType instanceof UTF8Type)
        return find(cfm);

    // We have a Thrift-created table with a non-text comparator. Check if we have a match column, otherwise assume we should use
    // thriftColumnNameType
    ByteBuffer bufferName = ByteBufferUtil.bytes(text);
    for (ColumnDefinition def : cfm.allColumns())
    {
        if (def.name.bytes.equals(bufferName))
            return def;
    }
    return find(thriftColumnNameType.fromString(text), cfm);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:20,代码来源:ColumnDefinition.java

示例5: ColumnIdentifier

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ColumnIdentifier(String rawText, boolean keepCase)
{
    this.text = keepCase ? rawText : rawText.toLowerCase(Locale.US);
    this.bytes = ByteBufferUtil.bytes(this.text);
    this.prefixComparison = prefixComparison(bytes);
    this.interned = false;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:8,代码来源:ColumnIdentifier.java

示例6: fromString

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer fromString(String source) throws MarshalException
{
  // Return an empty ByteBuffer for an empty string.
  if (source.isEmpty())
      return ByteBufferUtil.EMPTY_BYTE_BUFFER;

  return ByteBufferUtil.bytes(TimestampSerializer.dateStringToTimestamp(source));
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:9,代码来源:DateType.java

示例7: getInterned

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public static ColumnIdentifier getInterned(String rawText, boolean keepCase)
{
    String text = keepCase ? rawText : rawText.toLowerCase(Locale.US);
    ByteBuffer bytes = ByteBufferUtil.bytes(text);
    return getInterned(UTF8Type.instance, bytes, text);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:7,代码来源:ColumnIdentifier.java

示例8: toByteArray

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer toByteArray(Token token)
{
    LongToken longToken = (LongToken) token;
    return ByteBufferUtil.bytes(longToken.token);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:6,代码来源:Murmur3Partitioner.java

示例9: decompose

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
@Override
public ByteBuffer decompose(Long value)
{
    return ByteBufferUtil.bytes(value);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:6,代码来源:CounterColumnType.java

示例10: fromTimeInMillis

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer fromTimeInMillis(long millis) throws MarshalException
{
    return ByteBufferUtil.bytes(millis);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:TimestampType.java

示例11: serialize

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer serialize(Double value)
{
    return (value == null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:DoubleSerializer.java

示例12: fromString

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer fromString(String source) throws MarshalException
{
    return ByteBufferUtil.bytes(SimpleDateSerializer.dateStringToDays(source));
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:SimpleDateType.java

示例13: serialize

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer serialize(Float value)
{
    return (value == null) ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:FloatSerializer.java

示例14: serialize

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer serialize(Integer value)
{
    return value == null ? ByteBufferUtil.EMPTY_BYTE_BUFFER : ByteBufferUtil.bytes(value);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:SimpleDateSerializer.java

示例15: serialize

import org.apache.cassandra.utils.ByteBufferUtil; //导入方法依赖的package包/类
public ByteBuffer serialize(String value)
{
    return ByteBufferUtil.bytes(value, charset);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:AbstractTextSerializer.java


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