org.apache.cassandra.utils.Hex.wrapCharArray()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中org.apache.cassandra.utils.Hex.wrapCharArray()方法的一些代码示例,展示了Hex.wrapCharArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hex.wrapCharArray()方法的具体详情如下:
包路径:org.apache.cassandra.utils.Hex
类名称:Hex
方法名:wrapCharArray

Hex.wrapCharArray介绍

[英]Create a String from a char array with zero-copy (if available), using reflection to access a package-protected constructor of String.
[中]从具有零拷贝(如果可用)的字符数组创建字符串,使用反射访问受包保护的字符串构造函数。

代码示例

代码示例来源:origin: org.apache.cassandra/cassandra-all

public static String bytesToHex(byte bytes[], int offset, int length)
{
  char[] c = new char[length * 2];
  for (int i = 0; i < length; i++)
  {
    int bint = bytes[i + offset];
    c[i * 2] = byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = byteToChar[bint & 0x0f];
  }
  return wrapCharArray(c);
}

代码示例来源:origin: jsevellec/cassandra-unit

public static String bytesToHex(byte bytes[], int offset, int length)
{
  char[] c = new char[length * 2];
  for (int i = 0; i < length; i++)
  {
    int bint = bytes[i + offset];
    c[i * 2] = byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = byteToChar[bint & 0x0f];
  }
  return wrapCharArray(c);
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public static String bytesToHex(byte bytes[], int offset, int length)
{
  char[] c = new char[length * 2];
  for (int i = 0; i < length; i++)
  {
    int bint = bytes[i + offset];
    c[i * 2] = byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = byteToChar[bint & 0x0f];
  }
  return wrapCharArray(c);
}

代码示例来源:origin: org.apache.cassandra/cassandra-clientutil

public static String bytesToHex(byte bytes[], int offset, int length)
{
  char[] c = new char[length * 2];
  for (int i = 0; i < length; i++)
  {
    int bint = bytes[i + offset];
    c[i * 2] = byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = byteToChar[bint & 0x0f];
  }
  return wrapCharArray(c);
}

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static String bytesToHex(byte bytes[], int offset, int length)
{
  char[] c = new char[length * 2];
  for (int i = 0; i < length; i++)
  {
    int bint = bytes[i + offset];
    c[i * 2] = byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = byteToChar[bint & 0x0f];
  }
  return wrapCharArray(c);
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public static String bytesToHex(byte... bytes)
{
  char[] c = new char[bytes.length * 2];
  for (int i = 0; i < bytes.length; i++)
  {
    int bint = bytes[i];
    c[i * 2] = byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = byteToChar[bint & 0x0f];
  }
  return wrapCharArray(c);
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

public static String bytesToHex(ByteBuffer bytes)
{
  final int offset = bytes.position();
  final int size = bytes.remaining();
  final char[] c = new char[size * 2];
  for (int i = 0; i < size; i++)
  {
    final int bint = bytes.get(i+offset);
    c[i * 2] = Hex.byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = Hex.byteToChar[bint & 0x0f];
  }
  return Hex.wrapCharArray(c);
}

代码示例来源:origin: com.netflix.sstableadaptor/sstable-adaptor-cassandra

public static String bytesToHex(ByteBuffer bytes)
{
  if (bytes.hasArray())
  {
    return Hex.bytesToHex(bytes.array(), bytes.arrayOffset() + bytes.position(), bytes.remaining());
  }
  final int offset = bytes.position();
  final int size = bytes.remaining();
  final char[] c = new char[size * 2];
  for (int i = 0; i < size; i++)
  {
    final int bint = bytes.get(i+offset);
    c[i * 2] = Hex.byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = Hex.byteToChar[bint & 0x0f];
  }
  return Hex.wrapCharArray(c);
}

代码示例来源:origin: org.apache.cassandra/cassandra-clientutil

public static String bytesToHex(ByteBuffer bytes)
{
  if (bytes.hasArray()) {
    return Hex.bytesToHex(bytes.array(), bytes.arrayOffset() + bytes.position(), bytes.remaining());
  }
  final int offset = bytes.position();
  final int size = bytes.remaining();
  final char[] c = new char[size * 2];
  for (int i = 0; i < size; i++)
  {
    final int bint = bytes.get(i+offset);
    c[i * 2] = Hex.byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = Hex.byteToChar[bint & 0x0f];
  }
  return Hex.wrapCharArray(c);
}

代码示例来源:origin: jsevellec/cassandra-unit

public static String bytesToHex(ByteBuffer bytes)
{
  if (bytes.hasArray())
  {
    return Hex.bytesToHex(bytes.array(), bytes.arrayOffset() + bytes.position(), bytes.remaining());
  }
  final int offset = bytes.position();
  final int size = bytes.remaining();
  final char[] c = new char[size * 2];
  for (int i = 0; i < size; i++)
  {
    final int bint = bytes.get(i+offset);
    c[i * 2] = Hex.byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = Hex.byteToChar[bint & 0x0f];
  }
  return Hex.wrapCharArray(c);
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public static String bytesToHex(ByteBuffer bytes)
{
  if (bytes.hasArray())
  {
    return Hex.bytesToHex(bytes.array(), bytes.arrayOffset() + bytes.position(), bytes.remaining());
  }
  final int offset = bytes.position();
  final int size = bytes.remaining();
  final char[] c = new char[size * 2];
  for (int i = 0; i < size; i++)
  {
    final int bint = bytes.get(i+offset);
    c[i * 2] = Hex.byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = Hex.byteToChar[bint & 0x0f];
  }
  return Hex.wrapCharArray(c);
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

public static String bytesToHex(ByteBuffer bytes)
{
  if (bytes.hasArray())
  {
    return Hex.bytesToHex(bytes.array(), bytes.arrayOffset() + bytes.position(), bytes.remaining());
  }
  final int offset = bytes.position();
  final int size = bytes.remaining();
  final char[] c = new char[size * 2];
  for (int i = 0; i < size; i++)
  {
    final int bint = bytes.get(i+offset);
    c[i * 2] = Hex.byteToChar[(bint & 0xf0) >> 4];
    c[1 + i * 2] = Hex.byteToChar[bint & 0x0f];
  }
  return Hex.wrapCharArray(c);
}

相关文章