@Test public void testBasicOperations() throws Exception { String text = "ah blahblah"; BufferedLineReaderInputStream instream = create(text, 32); Assert.assertEquals((byte) 'a', instream.read()); Assert.assertEquals((byte) 'h', instream.read()); Assert.assertEquals((byte) ' ', instream.read()); byte[] tmp1 = new byte[4]; Assert.assertEquals(4, instream.read(tmp1)); Assert.assertEquals(4, instream.read(tmp1)); Assert.assertEquals(-1, instream.read(tmp1)); Assert.assertEquals(-1, instream.read(tmp1)); Assert.assertEquals(-1, instream.read()); Assert.assertEquals(-1, instream.read()); instream.close(); }
@Override public int read() throws IOException { if (!readAllowed()) return -1; int noRead; while (!hasBufferedData()) { noRead = fillBuffer(); if (noRead == -1) { return -1; } } return this.buffer[this.bufpos++] & 0xff; }
BufferedLineReaderInputStream extends LineReaderInputStream { @Override public int read() throws IOException { if (!readAllowed()) return -1; int noRead; while (!hasBufferedData()) { noRead = fillBuffer(); if (noRead == -1) { return -1; } } return this.buffer[this.bufpos++] & 0xff; } }
BufferedLineReaderInputStream extends LineReaderInputStream { @Override public int read() throws IOException { if (!readAllowed()) return -1; int noRead; while (!hasBufferedData()) { noRead = fillBuffer(); if (noRead == -1) { return -1; } } return this.buffer[this.bufpos++] & 0xff; } BufferedLineReaderInputStream(
            final InputStream instream,
            int buffersize,
            int maxLineLen);  BufferedLineReaderInputStream(
            final InputStream instream,
            int buffersize); }
BufferedLineReaderInputStream extends LineReaderInputStream { @Override public int read() throws IOException { if (!readAllowed()) return -1; int noRead; while (!hasBufferedData()) { noRead = fillBuffer(); if (noRead == -1) { return -1; } } return this.buffer[this.bufpos++] & 0xff; } BufferedLineReaderInputStream(
            final InputStream instream,
            int buffersize,
            int maxLineLen);  BufferedLineReaderInputStream(
            final InputStream instream,
            int buffersize); void ensureCapacity(int len); int fillBuffer(); boolean hasBufferedData(); void truncate(); @Override int read(); @Override int read(final byte[] b, int off, int len); @Override int read(final byte[] b); @Override boolean markSupported(); @Override int readLine(final ByteArrayBuffer dst); int indexOf(final byte[] pattern, int off, int len); int indexOf(final byte[] pattern); int indexOf(byte b, int off, int len); int indexOf(byte b); int byteAt(int pos); int capacity(); @Override String toString(); @Override boolean unread(ByteArrayBuffer buf); }
BufferedLineReaderInputStream extends LineReaderInputStream { @Override public int read() throws IOException { if (!readAllowed()) return -1; int noRead; while (!hasBufferedData()) { noRead = fillBuffer(); if (noRead == -1) { return -1; } } return this.buffer[this.bufpos++] & 0xff; } BufferedLineReaderInputStream(
            final InputStream instream,
            int buffersize,
            int maxLineLen);  BufferedLineReaderInputStream(
            final InputStream instream,
            int buffersize); void ensureCapacity(int len); int fillBuffer(); boolean hasBufferedData(); void truncate(); @Override int read(); @Override int read(final byte[] b, int off, int len); @Override int read(final byte[] b); @Override boolean markSupported(); @Override int readLine(final ByteArrayBuffer dst); int indexOf(final byte[] pattern, int off, int len); int indexOf(final byte[] pattern); int indexOf(byte b, int off, int len); int indexOf(byte b); int byteAt(int pos); int capacity(); @Override String toString(); @Override boolean unread(ByteArrayBuffer buf);  }