org.apache.calcite.avatica.util.ByteString.indexOf()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(124)

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

ByteString.indexOf介绍

[英]Returns the position at which seek first occurs in this byte string, or -1 if it does not occur.
[中]返回此字节字符串中首次出现搜索的位置,如果未出现,则返回-1。

代码示例

代码示例来源:origin: org.apache.calcite.avatica/avatica-core

/** Returns the position at which {@code seek} first occurs in this byte
 * string, or -1 if it does not occur. */
public int indexOf(ByteString seek) {
 return indexOf(seek, 0);
}

代码示例来源:origin: org.apache.kylin/atopcalcite

/** SQL {@code POSITION(seek IN string)} function for byte strings. */
public static int position(ByteString seek, ByteString s) {
  return s.indexOf(seek) + 1;
}

代码示例来源:origin: org.apache.calcite/calcite-core

/** SQL {@code POSITION(seek IN string)} function for byte strings. */
public static int position(ByteString seek, ByteString s) {
 return s.indexOf(seek) + 1;
}

代码示例来源:origin: apache/calcite-avatica

/** Returns the position at which {@code seek} first occurs in this byte
 * string, or -1 if it does not occur. */
public int indexOf(ByteString seek) {
 return indexOf(seek, 0);
}

代码示例来源:origin: Qihoo360/Quicksql

/** SQL {@code POSITION(seek IN string)} function for byte strings. */
public static int position(ByteString seek, ByteString s) {
 return s.indexOf(seek) + 1;
}

代码示例来源:origin: Qihoo360/Quicksql

/** SQL {@code POSITION(seek IN string FROM integer)} function for byte
 * strings. */
public static int position(ByteString seek, ByteString s, int from) {
 final int from0 = from - 1;
 if (from0 > s.length() || from0 < 0) {
  return 0;
 }
 // ByteString doesn't have indexOf(ByteString, int) until avatica-1.9
 // (see [CALCITE-1423]), so apply substring and find from there.
 Bug.upgrade("in avatica-1.9, use ByteString.substring(ByteString, int)");
 final int p = s.substring(from0).indexOf(seek);
 if (p < 0) {
  return 0;
 }
 return p + from;
}

代码示例来源:origin: org.apache.calcite/calcite-core

/** SQL {@code POSITION(seek IN string FROM integer)} function for byte
 * strings. */
public static int position(ByteString seek, ByteString s, int from) {
 final int from0 = from - 1;
 if (from0 > s.length() || from0 < 0) {
  return 0;
 }
 // ByteString doesn't have indexOf(ByteString, int) until avatica-1.9
 // (see [CALCITE-1423]), so apply substring and find from there.
 Bug.upgrade("in avatica-1.9, use ByteString.substring(ByteString, int)");
 final int p = s.substring(from0).indexOf(seek);
 if (p < 0) {
  return 0;
 }
 return p + from;
}

代码示例来源:origin: org.apache.kylin/atopcalcite

/** SQL {@code POSITION(seek IN string FROM integer)} function for byte
 * strings. */
public static int position(ByteString seek, ByteString s, int from) {
  final int from0 = from - 1;
  if (from0 > s.length() || from0 < 0) {
    return 0;
  }
  // ByteString doesn't have indexOf(ByteString, int) until avatica-1.9
  // (see [CALCITE-1423]), so apply substring and find from there.
  Bug.upgrade("in avatica-1.9, use ByteString.substring(ByteString, int)");
  final int p = s.substring(from0).indexOf(seek);
  if (p < 0) {
    return 0;
  }
  return p + from;
}

代码示例来源:origin: apache/calcite-avatica

assertThat(s.indexOf(s3), is(0));
assertThat(s.indexOf(s3, 5), is(5));
assertThat(s.indexOf(s3, 15), is(-1));
assertThat(s.indexOf(s4), is(4));
assertThat(s.indexOf(s4, 4), is(4));
assertThat(s.indexOf(s4, 5), is(7));
assertThat(s.indexOf(s5), is(2));
assertThat(s.indexOf(s5, 2), is(2));
assertThat(s.indexOf(s5, 3), is(-1));
assertThat(s.indexOf(s5, 7), is(-1));

代码示例来源:origin: org.apache.calcite.avatica/avatica-core

assertThat(s.indexOf(s3), is(0));
assertThat(s.indexOf(s3, 5), is(5));
assertThat(s.indexOf(s3, 15), is(-1));
assertThat(s.indexOf(s4), is(4));
assertThat(s.indexOf(s4, 4), is(4));
assertThat(s.indexOf(s4, 5), is(7));
assertThat(s.indexOf(s5), is(2));
assertThat(s.indexOf(s5, 2), is(2));
assertThat(s.indexOf(s5, 3), is(-1));
assertThat(s.indexOf(s5, 7), is(-1));

代码示例来源:origin: Qihoo360/Quicksql

final ByteString byteString3 = new ByteString(bytes3);
assertEquals(0, byteString.indexOf(emptyByteString));
assertEquals(-1, byteString.indexOf(byteString1));
assertEquals(1, byteString.indexOf(byteString3));
assertEquals(-1, byteString3.indexOf(byteString));

代码示例来源:origin: org.apache.calcite/calcite-core

final ByteString byteString3 = new ByteString(bytes3);
assertEquals(0, byteString.indexOf(emptyByteString));
assertEquals(-1, byteString.indexOf(byteString1));
assertEquals(1, byteString.indexOf(byteString3));
assertEquals(-1, byteString3.indexOf(byteString));

相关文章