1 5 package org.h2.test.unit; 6 7 import java.io.ByteArrayInputStream ; 8 import java.io.InputStream ; 9 import java.io.Reader ; 10 import java.io.StringReader ; 11 12 import org.h2.test.TestBase; 13 import org.h2.util.IOUtils; 14 15 public class TestReader extends TestBase { 16 17 public void test() throws Exception { 18 String s = "\u00ef\u00f6\u00fc"; 19 StringReader r = new StringReader (s); 20 InputStream in = IOUtils.getInputStream(r); 21 byte[] buff = IOUtils.readBytesAndClose(in, 0); 22 InputStream in2 = new ByteArrayInputStream (buff); 23 Reader r2 = IOUtils.getReader(in2); 24 String s2 = IOUtils.readStringAndClose(r2, Integer.MAX_VALUE); 25 check(s2, "\u00ef\u00f6\u00fc"); 26 } 27 28 } 29 | Popular Tags |