org.apache.hadoop.hbase.util.Bytes.indexOf()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(86)

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

Bytes.indexOf介绍

[英]Returns the index of the first appearance of the value target in array.
[中]返回数组中值目标的第一次出现的索引。

代码示例

代码示例来源:origin: apache/hbase

/**
 * @param array an array of {@code byte} values, possibly empty
 * @param target a primitive {@code byte} value
 * @return {@code true} if {@code target} is present as an element anywhere in {@code array}.
 */
public static boolean contains(byte[] array, byte target) {
 return indexOf(array, target) > -1;
}

代码示例来源:origin: apache/hbase

/**
 * @param array an array of {@code byte} values, possibly empty
 * @param target an array of {@code byte}
 * @return {@code true} if {@code target} is present anywhere in {@code array}
 */
public static boolean contains(byte[] array, byte[] target) {
 return indexOf(array, target) > -1;
}

代码示例来源:origin: apache/hbase

final private static int validateCompositeKey(byte[] keyBytes) {
 int separatorIdx = Bytes.indexOf(keyBytes, tableSeparator);
 // Either the separator was not found or a tablename wasn't present or a key wasn't present
 if (separatorIdx == -1) {
  throw new IllegalArgumentException("Invalid format for composite key [" + Bytes
      .toStringBinary(keyBytes) + "]. Cannot extract tablename and suffix from key");
 }
 return separatorIdx;
}

代码示例来源:origin: apache/hbase

private Counter getCounter(byte[] row) {
  Counter c = null;
  if (Bytes.indexOf(row, Bytes.toBytes(VISIBILITY_EXPS[0])) != -1) {
   c = rowsExp1;
  } else if (Bytes.indexOf(row, Bytes.toBytes(VISIBILITY_EXPS[1])) != -1) {
   c = rowsExp2;
  } else if (Bytes.indexOf(row, Bytes.toBytes(VISIBILITY_EXPS[2])) != -1) {
   c = rowsExp3;
  } else if (Bytes.indexOf(row, Bytes.toBytes(VISIBILITY_EXPS[3])) != -1) {
   c = rowsExp4;
  }
  return c;
 }
}

代码示例来源:origin: apache/hbase

public void testIndexOf() {
 byte[] array = Bytes.toBytes("hello");
 assertEquals(1, Bytes.indexOf(array, (byte) 'e'));
 assertEquals(4, Bytes.indexOf(array, (byte) 'o'));
 assertEquals(-1, Bytes.indexOf(array, (byte) 'a'));
 assertEquals(0, Bytes.indexOf(array, Bytes.toBytes("hel")));
 assertEquals(2, Bytes.indexOf(array, Bytes.toBytes("ll")));
 assertEquals(-1, Bytes.indexOf(array, Bytes.toBytes("hll")));
}

代码示例来源:origin: apache/hbase

/**
  * @param cell the new cell
  * @return the new cell created by delimited row prefix
  */
 private Cell getDelimitedRowPrefixCell(Cell cell) {
  byte[] row = CellUtil.copyRow(cell);
  int prefixLength = Bytes.indexOf(row, delimiter);
  if (prefixLength <= 0) {
   return cell;
  }
  return ExtendedCellBuilderFactory.create(CellBuilderType.DEEP_COPY)
    .setRow(row, 0, Math.min(prefixLength, row.length))
    .setType(Cell.Type.Put)
    .build();
 }
}

代码示例来源:origin: apache/hbase

byte[] rowPrefix;
if (scan.isGetScan()) {
 int rowPrefixLength = Bytes.indexOf(row, delimiter);
 if (rowPrefixLength <= 0) {
  rowPrefix = row;
 int startRowPrefixLength = Bytes.indexOf(row, delimiter);
 if (startRowPrefixLength <= 0) {
  return true;

代码示例来源:origin: org.apache.hbase/hbase-common

/**
 * @param array an array of {@code byte} values, possibly empty
 * @param target a primitive {@code byte} value
 * @return {@code true} if {@code target} is present as an element anywhere in {@code array}.
 */
public static boolean contains(byte[] array, byte target) {
 return indexOf(array, target) > -1;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

/**
 * @param array an array of {@code byte} values, possibly empty
 * @param target a primitive {@code byte} value
 * @return {@code true} if {@code target} is present as an element anywhere in {@code array}.
 */
public static boolean contains(byte[] array, byte target) {
 return indexOf(array, target) > -1;
}

代码示例来源:origin: org.apache.hbase/hbase-common

/**
 * @param array an array of {@code byte} values, possibly empty
 * @param target an array of {@code byte}
 * @return {@code true} if {@code target} is present anywhere in {@code array}
 */
public static boolean contains(byte[] array, byte[] target) {
 return indexOf(array, target) > -1;
}

代码示例来源:origin: harbby/presto-connectors

/**
 * @param array an array of {@code byte} values, possibly empty
 * @param target a primitive {@code byte} value
 * @return {@code true} if {@code target} is present as an element anywhere in {@code array}.
 */
public static boolean contains(byte[] array, byte target) {
 return indexOf(array, target) > -1;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

/**
 * @param array an array of {@code byte} values, possibly empty
 * @param target an array of {@code byte}
 * @return {@code true} if {@code target} is present anywhere in {@code array}
 */
public static boolean contains(byte[] array, byte[] target) {
 return indexOf(array, target) > -1;
}

代码示例来源:origin: harbby/presto-connectors

/**
 * @param array an array of {@code byte} values, possibly empty
 * @param target an array of {@code byte}
 * @return {@code true} if {@code target} is present anywhere in {@code array}
 */
public static boolean contains(byte[] array, byte[] target) {
 return indexOf(array, target) > -1;
}

代码示例来源:origin: org.apache.hbase/hbase-mapreduce

final private static int validateCompositeKey(byte[] keyBytes) {
 int separatorIdx = Bytes.indexOf(keyBytes, tableSeparator);
 // Either the separator was not found or a tablename wasn't present or a key wasn't present
 if (separatorIdx == -1) {
  throw new IllegalArgumentException("Invalid format for composite key [" + Bytes
      .toStringBinary(keyBytes) + "]. Cannot extract tablename and suffix from key");
 }
 return separatorIdx;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-mapreduce

final private static int validateCompositeKey(byte[] keyBytes) {
 int separatorIdx = Bytes.indexOf(keyBytes, tableSeparator);
 // Either the separator was not found or a tablename wasn't present or a key wasn't present
 if (separatorIdx == -1) {
  throw new IllegalArgumentException("Invalid format for composite key [" + Bytes
      .toStringBinary(keyBytes) + "]. Cannot extract tablename and suffix from key");
 }
 return separatorIdx;
}

代码示例来源:origin: org.apache.hbase/hbase-it

private Counter getCounter(byte[] row) {
  Counter c = null;
  if (Bytes.indexOf(row, Bytes.toBytes(VISIBILITY_EXPS[0])) != -1) {
   c = rowsExp1;
  } else if (Bytes.indexOf(row, Bytes.toBytes(VISIBILITY_EXPS[1])) != -1) {
   c = rowsExp2;
  } else if (Bytes.indexOf(row, Bytes.toBytes(VISIBILITY_EXPS[2])) != -1) {
   c = rowsExp3;
  } else if (Bytes.indexOf(row, Bytes.toBytes(VISIBILITY_EXPS[3])) != -1) {
   c = rowsExp4;
  }
  return c;
 }
}

代码示例来源:origin: org.apache.hbase/hbase-common

public void testIndexOf() {
 byte[] array = Bytes.toBytes("hello");
 assertEquals(1, Bytes.indexOf(array, (byte) 'e'));
 assertEquals(4, Bytes.indexOf(array, (byte) 'o'));
 assertEquals(-1, Bytes.indexOf(array, (byte) 'a'));
 assertEquals(0, Bytes.indexOf(array, Bytes.toBytes("hel")));
 assertEquals(2, Bytes.indexOf(array, Bytes.toBytes("ll")));
 assertEquals(-1, Bytes.indexOf(array, Bytes.toBytes("hll")));
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

public void testIndexOf() {
 byte[] array = Bytes.toBytes("hello");
 assertEquals(1, Bytes.indexOf(array, (byte) 'e'));
 assertEquals(4, Bytes.indexOf(array, (byte) 'o'));
 assertEquals(-1, Bytes.indexOf(array, (byte) 'a'));
 assertEquals(0, Bytes.indexOf(array, Bytes.toBytes("hel")));
 assertEquals(2, Bytes.indexOf(array, Bytes.toBytes("ll")));
 assertEquals(-1, Bytes.indexOf(array, Bytes.toBytes("hll")));
}

相关文章

微信公众号

最新文章

更多