@Test public void testGetOldestByte() { final byte[] pattern = new byte[]{ '\r', '0', 38, 48 }; final byte[] search = new byte[]{ '\r', '0', 38, 58, 58, 83, 78, (byte) 223, (byte) 227, (byte) 250, '\r', '0', 38, 48, 83, 92, 78, 4, 38 }; final NaiveSearchRingBuffer circ = new NaiveSearchRingBuffer(pattern); int counter = -1; for (final byte b : search) { counter++; final boolean matched = circ.addAndCompare(b); if (counter == 13) { assertTrue(matched); } else { assertFalse(matched); } } }
public int getOldestByte() { return buffer[insertionPointer]; }
NaiveSearchRingBuffer { public int getOldestByte() { return buffer[insertionPointer]; } }
NaiveSearchRingBuffer { public int getOldestByte() { return buffer[insertionPointer]; } NaiveSearchRingBuffer(final byte[] lookingFor); }
NaiveSearchRingBuffer { public int getOldestByte() { return buffer[insertionPointer]; } NaiveSearchRingBuffer(final byte[] lookingFor); byte[] getBufferContents(); int getOldestByte(); boolean isFilled(); void clear(); boolean addAndCompare(final byte data); }
NaiveSearchRingBuffer { public int getOldestByte() { return buffer[insertionPointer]; } NaiveSearchRingBuffer(final byte[] lookingFor); byte[] getBufferContents(); int getOldestByte(); boolean isFilled(); void clear(); boolean addAndCompare(final byte data);  }