PumpReader extends Reader { public java.io.InputStream createInputStream(Charset charset) { return new InputStream(this, charset); } PumpReader();  PumpReader(int bufferSize); java.io.Writer getWriter(); java.io.InputStream createInputStream(Charset charset); @Override synchronized boolean ready(); synchronized int available(); @Override synchronized int read(); @Override synchronized int read(char[] cbuf, int off, int len); @Override int read(CharBuffer target); @Override synchronized void close();  }
@Test public void testInputStream() throws IOException { PumpReader pump = writeInput(); BufferedReader reader = new BufferedReader(new InputStreamReader(pump.createInputStream(StandardCharsets.UTF_8), StandardCharsets.UTF_8)); assertEquals("Hello world!", reader.readLine()); assertEquals("㐀", reader.readLine()); }