### Question:
ByteUtilities { public static boolean readUntilInclusive(PushbackInputStream in, OutputStream out, byte[] marker) throws IOException { int bytesRead; byte[] bytes = new byte[BUFFER_SIZE]; byte[] mostRecentBytes = new byte[marker.length - 1]; while ((bytesRead = in.read(bytes)) != -1) { if (bytesRead > 0) { int index = indexOf(bytes, bytesRead, marker); if (index != -1) { int writeLength = index + marker.length; out.write(bytes, 0, writeLength); in.unread(bytes, writeLength, bytesRead - writeLength); break; } else { byte[] combinedBytes = concat(mostRecentBytes, bytes, Math.min(bytesRead, marker.length - 1)); index = indexOf(combinedBytes, combinedBytes.length, marker); if (index != -1) { out.write(bytes, 0, index + 1); break; } else { out.write(bytes, 0, bytesRead); } } shift(mostRecentBytes, bytes, bytesRead); } } return bytesRead == -1; } private  ByteUtilities(); static int readNBytes(InputStream in, OutputStream out, int byteCount); static boolean readUntilInclusive(PushbackInputStream in, OutputStream out, byte[] marker);  }### Answer:
@Test public void testReadUntilInclusive() throws IOException { PushbackInputStream in = new PushbackInputStream(new ByteArrayInputStream(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }), 10); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteUtilities.readUntilInclusive(in, out, new byte[] { 4, 5, 6 }); Assert.assertTrue(Arrays.equals(new byte[] { 1, 2, 3, 4, 5, 6 }, out.toByteArray())); Assert.assertEquals(7, in.read()); Assert.assertEquals(8, in.read()); Assert.assertEquals(-1, in.read()); }