Search in sources :

Example 1 with ReaderInputStream

use of org.h2.dev.util.ReaderInputStream in project h2database by h2database.

the class TestReader method test.

@Override
public void test() throws Exception {
    String s = "\u00ef\u00f6\u00fc";
    StringReader r = new StringReader(s);
    InputStream in = new ReaderInputStream(r);
    byte[] buff = IOUtils.readBytesAndClose(in, 0);
    InputStream in2 = new ByteArrayInputStream(buff);
    Reader r2 = IOUtils.getBufferedReader(in2);
    String s2 = IOUtils.readStringAndClose(r2, Integer.MAX_VALUE);
    assertEquals(s, s2);
}
Also used : ReaderInputStream(org.h2.dev.util.ReaderInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) ReaderInputStream(org.h2.dev.util.ReaderInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) StringReader(java.io.StringReader) StringReader(java.io.StringReader) Reader(java.io.Reader)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 ReaderInputStream (org.h2.dev.util.ReaderInputStream)1