@Test public void testReadEmptyLine() throws Exception { String teststr = "\n\n\r\n\r\r\n\n\n\n\n\n"; byte[] raw = teststr.getBytes("US-ASCII"); LineReaderInputStreamAdaptor instream = create(raw); ByteArrayBuffer linebuf = new ByteArrayBuffer(8); linebuf.clear(); instream.readLine(linebuf); String s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\n", s); linebuf.clear(); instream.readLine(linebuf); s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\n", s); linebuf.clear(); instream.readLine(linebuf); s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\r\n", s); linebuf.clear(); instream.readLine(linebuf); s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\r\r\n", s); linebuf.clear(); instream.readLine(linebuf); s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\n", s); linebuf.clear(); instream.readLine(linebuf); s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\n", s); linebuf.clear(); instream.readLine(linebuf); s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\n", s); linebuf.clear(); instream.readLine(linebuf); s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\n", s); linebuf.clear(); instream.readLine(linebuf); s = ContentUtil.toAsciiString(linebuf); Assert.assertEquals("\n", s); Assert.assertEquals(-1, instream.readLine(linebuf)); Assert.assertEquals(-1, instream.readLine(linebuf)); instream.close(); }
@Override public int readLine(final ByteArrayBuffer dst) throws MaxLineLimitException, IOException { int i; if (this.bis != null) { i = this.bis.readLine(dst); } else { i = doReadLine(dst); } this.eof = i == -1; this.used = true; return i; }
LineReaderInputStreamAdaptor extends LineReaderInputStream { @Override public int readLine(final ByteArrayBuffer dst) throws MaxLineLimitException, IOException { int i; if (this.bis != null) { i = this.bis.readLine(dst); } else { i = doReadLine(dst); } this.eof = i == -1; this.used = true; return i; } }
LineReaderInputStreamAdaptor extends LineReaderInputStream { @Override public int readLine(final ByteArrayBuffer dst) throws MaxLineLimitException, IOException { int i; if (this.bis != null) { i = this.bis.readLine(dst); } else { i = doReadLine(dst); } this.eof = i == -1; this.used = true; return i; } LineReaderInputStreamAdaptor(
            final InputStream is,
            int maxLineLen);  LineReaderInputStreamAdaptor(
            final InputStream is); }
LineReaderInputStreamAdaptor extends LineReaderInputStream { @Override public int readLine(final ByteArrayBuffer dst) throws MaxLineLimitException, IOException { int i; if (this.bis != null) { i = this.bis.readLine(dst); } else { i = doReadLine(dst); } this.eof = i == -1; this.used = true; return i; } LineReaderInputStreamAdaptor(
            final InputStream is,
            int maxLineLen);  LineReaderInputStreamAdaptor(
            final InputStream is); @Override int read(); @Override int read(byte[] b, int off, int len); @Override int readLine(final ByteArrayBuffer dst); boolean eof(); boolean isUsed(); @Override String toString(); @Override boolean unread(ByteArrayBuffer buf); @Override long skip(long count); }
LineReaderInputStreamAdaptor extends LineReaderInputStream { @Override public int readLine(final ByteArrayBuffer dst) throws MaxLineLimitException, IOException { int i; if (this.bis != null) { i = this.bis.readLine(dst); } else { i = doReadLine(dst); } this.eof = i == -1; this.used = true; return i; } LineReaderInputStreamAdaptor(
            final InputStream is,
            int maxLineLen);  LineReaderInputStreamAdaptor(
            final InputStream is); @Override int read(); @Override int read(byte[] b, int off, int len); @Override int readLine(final ByteArrayBuffer dst); boolean eof(); boolean isUsed(); @Override String toString(); @Override boolean unread(ByteArrayBuffer buf); @Override long skip(long count);  }