@Test public void testIndexOf() throws Exception { final byte COLON = (byte) ':'; final byte COMMA = (byte) ','; byte[] bytes = "name1: value1; name2: value2".getBytes("US-ASCII"); int index1 = 5; int index2 = 20; ByteArrayBuffer buffer = new ByteArrayBuffer(16); buffer.append(bytes, 0, bytes.length); Assert.assertEquals(index1, buffer.indexOf(COLON)); Assert.assertEquals(-1, buffer.indexOf(COMMA)); Assert.assertEquals(index1, buffer.indexOf(COLON, -1, 11)); Assert.assertEquals(index1, buffer.indexOf(COLON, 0, 1000)); Assert.assertEquals(-1, buffer.indexOf(COLON, 2, 1)); Assert.assertEquals(index2, buffer.indexOf(COLON, index1 + 1, buffer.length())); System.out.println(String.format("[CRAFT-ATOM-UTIL] (^_^) <%s> Case -> test indexof. ", CaseCounter.incr(6))); }
public int indexOf(byte b) { return ByteUtil.indexOf(this.buffer, b); }
ByteArrayBuffer implements Serializable { public int indexOf(byte b) { return ByteUtil.indexOf(this.buffer, b); } }
ByteArrayBuffer implements Serializable { public int indexOf(byte b) { return ByteUtil.indexOf(this.buffer, b); } ByteArrayBuffer();  ByteArrayBuffer(int capacity);  ByteArrayBuffer(final byte[] bytes); }
ByteArrayBuffer implements Serializable { public int indexOf(byte b) { return ByteUtil.indexOf(this.buffer, b); } ByteArrayBuffer();  ByteArrayBuffer(int capacity);  ByteArrayBuffer(final byte[] bytes); ByteArrayBuffer append(final byte[] b, int off, int len); ByteArrayBuffer append(byte b); ByteArrayBuffer append(final byte[] b); void clear(); void reset(int capacity); byte[] array(); byte[] array(int start, int end); byte byteAt(int i); int capacity(); int length(); byte[] buffer(); boolean isEmpty(); boolean isFull(); int indexOf(byte b); int indexOf(byte b, int beginIndex, int endIndex); int indexOf(byte[] bytes); int indexOf(byte[] bytes, int beginIndex); int indexOf(byte[] bytes, int beginIndex, int endIndex); }
ByteArrayBuffer implements Serializable { public int indexOf(byte b) { return ByteUtil.indexOf(this.buffer, b); } ByteArrayBuffer();  ByteArrayBuffer(int capacity);  ByteArrayBuffer(final byte[] bytes); ByteArrayBuffer append(final byte[] b, int off, int len); ByteArrayBuffer append(byte b); ByteArrayBuffer append(final byte[] b); void clear(); void reset(int capacity); byte[] array(); byte[] array(int start, int end); byte byteAt(int i); int capacity(); int length(); byte[] buffer(); boolean isEmpty(); boolean isFull(); int indexOf(byte b); int indexOf(byte b, int beginIndex, int endIndex); int indexOf(byte[] bytes); int indexOf(byte[] bytes, int beginIndex); int indexOf(byte[] bytes, int beginIndex, int endIndex);  }