@Test public void readArray_random() throws Exception { byte[] bytes = "ABC|D|EF".getBytes(StandardCharsets.US_ASCII); InputBuffer buffer = new InputBuffer(); buffer.reset(bytes, bytes.length); Random random = new Random(12345); for (int i = 0; i < 100000; i++) { int[] bounds = new int[5]; for (int j = 0; j < bounds.length; j++) { bounds[j] = random.nextInt(bytes.length + 1); } Arrays.sort(bounds); StringBuilder buf = new StringBuilder(); int start = 0; for (int j = 0; j < bounds.length; j++) { int end = bounds[j]; copy(buffer, buf, start, end, 4); start = end; } copy(buffer, buf, start, bytes.length, 4); assertThat(Arrays.toString(bounds), buf.toString(), is("ABC|D|EF")); } }
@Override public synchronized void reset() throws IOException { throw new UnsupportedOperationException(); }
DelimiterRangeInputStream extends InputStream { @Override public synchronized void reset() throws IOException { throw new UnsupportedOperationException(); } }
DelimiterRangeInputStream extends InputStream { @Override public synchronized void reset() throws IOException { throw new UnsupportedOperationException(); } DelimiterRangeInputStream(
            InputStream stream,
            char delimiter,
            long length,
            boolean skipFirst); }
DelimiterRangeInputStream extends InputStream { @Override public synchronized void reset() throws IOException { throw new UnsupportedOperationException(); } DelimiterRangeInputStream(
            InputStream stream,
            char delimiter,
            long length,
            boolean skipFirst); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override int available(); @Override synchronized void mark(int readlimit); @Override synchronized void reset(); @Override boolean markSupported(); @Override void close(); }
DelimiterRangeInputStream extends InputStream { @Override public synchronized void reset() throws IOException { throw new UnsupportedOperationException(); } DelimiterRangeInputStream(
            InputStream stream,
            char delimiter,
            long length,
            boolean skipFirst); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override int available(); @Override synchronized void mark(int readlimit); @Override synchronized void reset(); @Override boolean markSupported(); @Override void close();  }