• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Hex类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.cassandra.utils.Hex的典型用法代码示例。如果您正苦于以下问题:Java Hex类的具体用法?Java Hex怎么用?Java Hex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: close

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
public void close()
{
    FileUtils.closeQuietly(writer);
    byte[] bytes = digest.digest();
    if (bytes == null)
        return;
    SequentialWriter out = SequentialWriter.open(new File(descriptor.filenameFor(SSTable.COMPONENT_DIGEST)), true);
    // Writting output compatible with sha1sum
    Descriptor newdesc = descriptor.asTemporary(false);
    String[] tmp = newdesc.filenameFor(SSTable.COMPONENT_DATA).split(Pattern.quote(File.separator));
    String dataFileName = tmp[tmp.length - 1];
    try
    {
        out.write(String.format("%s  %s", Hex.bytesToHex(bytes), dataFileName).getBytes());
    }
    catch (ClosedChannelException e)
    {
        throw new AssertionError(); // can't happen.
    }
    finally
    {
        FileUtils.closeQuietly(out);
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:25,代码来源:DataIntegrityMetadata.java


示例2: close

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
public void close()
{
    FileUtils.closeQuietly(writer);
    byte[] bytes = digest.digest();
    if (bytes == null)
        return;
    SequentialWriter out = SequentialWriter.open(new File(descriptor.filenameFor(Component.DIGEST)), true);
    // Writting output compatible with sha1sum
    Descriptor newdesc = descriptor.asTemporary(false);
    String[] tmp = newdesc.filenameFor(Component.DATA).split(Pattern.quote(File.separator));
    String dataFileName = tmp[tmp.length - 1];
    try
    {
        out.write(String.format("%s  %s", Hex.bytesToHex(bytes), dataFileName).getBytes());
    }
    catch (ClosedChannelException e)
    {
        throw new AssertionError(); // can't happen.
    }
    finally
    {
        FileUtils.closeQuietly(out);
    }
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:25,代码来源:DataIntegrityMetadata.java


示例3: deserializeIndexedColumns

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
/**
 * Serialize a set of ColumnDefs for indexed columns, read from Job
 * configuration
 *
 * @param serialized column metadata
 * @return list of column metadata objects which may be empty, but not null
 */
public static Set<ColumnDef> deserializeIndexedColumns(String serialized) {
    Set<ColumnDef> columns = new HashSet<ColumnDef>();
    if (null == serialized) {
        return columns;
    }

    Iterable<String> strings = Splitter.on(AbstractCassandraSerDe.DELIMITER).omitEmptyStrings().trimResults().split(serialized);
    TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
    for (String encoded : strings) {
        ColumnDef column = new ColumnDef();
        try {
            logger.info("Encoded column def: " + encoded);
            deserializer.deserialize(column, Hex.hexToBytes(encoded));
        } catch (TException e) {
            logger.warn("Error deserializing indexed column definition", e);
        }
        if (null == column.getName() || null == column.validation_class) {
            continue;
        }
        columns.add(column);
    }
    return columns;
}
 
开发者ID:2013Commons,项目名称:hive-cassandra,代码行数:31,代码来源:CqlPushdownPredicate.java


示例4: fromString

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
public ByteBuffer fromString(String source)
{
    try
    {
        return ByteBuffer.wrap(Hex.hexToBytes(source));
    }
    catch (NumberFormatException e)
    {
        throw new MarshalException(String.format("cannot parse '%s' as hex bytes", source), e);
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:12,代码来源:BytesType.java


示例5: validate

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
public void validate(String token) throws ConfigurationException
{
    try
    {
        if (token.length() % 2 == 1)
            token = "0" + token;
        Hex.hexToBytes(token);
    }
    catch (NumberFormatException e)
    {
        throw new ConfigurationException("Token " + token + " contains non-hex digits");
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:14,代码来源:AbstractByteOrderedPartitioner.java


示例6: toString

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
@Deprecated
public static String toString(List<Object> resource)
{
    StringBuilder buff = new StringBuilder();
    for (Object component : resource)
    {
        buff.append("/");
        if (component instanceof byte[])
            buff.append(Hex.bytesToHex((byte[])component));
        else
            buff.append(component.toString());
    }
    return buff.toString();
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:Resources.java


示例7: toString

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
@Deprecated
public static String toString(List<Object> resource)
{
    StringBuilder buff = new StringBuilder();
    for (Object component : resource)
    {
        buff.append("/");
        if (component instanceof byte[])
            buff.append(Hex.bytesToHex((byte[])component));
        else
            buff.append(component);
    }
    return buff.toString();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:Resources.java


示例8: testValueBytes

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
@Test
public void testValueBytes() {
    ColumnMapperBlob mapper = new ColumnMapperBlob();
    byte[] bytes = Hex.hexToBytes("f1");
    String parsed = mapper.indexValue("test", bytes);
    Assert.assertEquals("f1", parsed);
}
 
开发者ID:Stratio,项目名称:stratio-cassandra,代码行数:8,代码来源:ColumnMapperBlobTest.java


示例9: serializeIndexedColumns

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
/**
 * Serialize a set of ColumnDefs for indexed columns, so that it can be
 * written to Job configuration
 *
 * @param columns column metadata
 * @return serialized form
 */
public static String serializeIndexedColumns(Set<ColumnDef> columns) {
    TSerializer serializer = new TSerializer(new TBinaryProtocol.Factory());
    try {
        List<String> hexStrings = new ArrayList<String>();
        for (ColumnDef column : columns) {
            String encoded = Hex.bytesToHex(serializer.serialize(column));
            logger.info("Encoded column def: " + encoded);
            hexStrings.add(encoded);
        }
        return Joiner.on(AbstractCassandraSerDe.DELIMITER).join(hexStrings);
    } catch (TException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:2013Commons,项目名称:hive-cassandra,代码行数:22,代码来源:CqlPushdownPredicate.java


示例10: toString

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
@Override
public String toString() {
  StringBuilder valuesAsStrings = new StringBuilder();
  valuesAsStrings.append("[");
  for (ByteBuffer value : values) {
    valuesAsStrings.append(Hex.bytesToHex(value.array()));
    valuesAsStrings.append(",");
  }
  valuesAsStrings.deleteCharAt(valuesAsStrings.length()-1);
  valuesAsStrings.append("]");
  return String.format("CQLRecord(key=%s, values=%s", valuesAsStrings);
}
 
开发者ID:spotify,项目名称:hdfs2cass,代码行数:13,代码来源:CQLRecord.java


示例11: toString

import org.apache.cassandra.utils.Hex; //导入依赖的package包/类
@Override
public String toString()
{
    return Hex.bytesToHex(token);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:6,代码来源:BytesToken.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RestApiServer类代码示例发布时间:2022-05-21
下一篇:
Java HashTree类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap