@Test public void readsEqualToBlockSizeTest() throws Exception { final int blockSize = 8 * 1024; final int dataSize = blockSize + 57; final byte[] data = new byte[dataSize]; final byte[] buffer = new byte[blockSize]; InputStreamReader isr = new InputStreamReader(new ByteArrayInputStream(data), "UTF-8"); ReaderInputStream r = new ReaderInputStream(isr, blockSize); int total = 0; total += r.read(buffer, 0, blockSize); total += r.read(buffer, 0, blockSize); assertEquals("Data not read completely: missing " + (dataSize - total) + " bytes", dataSize, total); }
@Override public int read() throws IOException { int res = 0; while (res != -1) { res = read(oneByte); if (res > 0) { return oneByte[0]; } } return -1; }
ReaderInputStream extends InputStream { @Override public int read() throws IOException { int res = 0; while (res != -1) { res = read(oneByte); if (res > 0) { return oneByte[0]; } } return -1; } }
ReaderInputStream extends InputStream { @Override public int read() throws IOException { int res = 0; while (res != -1) { res = read(oneByte); if (res > 0) { return oneByte[0]; } } return -1; } ReaderInputStream(Reader reader);   ReaderInputStream(Reader reader, int charBufferSize); }
ReaderInputStream extends InputStream { @Override public int read() throws IOException { int res = 0; while (res != -1) { res = read(oneByte); if (res > 0) { return oneByte[0]; } } return -1; } ReaderInputStream(Reader reader);   ReaderInputStream(Reader reader, int charBufferSize); @Override int read(); @Override int read(byte[] b, int off, int len); @Override void close(); }
ReaderInputStream extends InputStream { @Override public int read() throws IOException { int res = 0; while (res != -1) { res = read(oneByte); if (res > 0) { return oneByte[0]; } } return -1; } ReaderInputStream(Reader reader);   ReaderInputStream(Reader reader, int charBufferSize); @Override int read(); @Override int read(byte[] b, int off, int len); @Override void close();  }