1 24 25 package org.objectweb.cjdbc.scenario.standalone.streams; 26 27 import java.io.File ; 28 import java.io.FileInputStream ; 29 import java.io.FileOutputStream ; 30 31 import org.objectweb.cjdbc.common.stream.CJDBCInputStream; 32 import org.objectweb.cjdbc.common.stream.CJDBCOutputStream; 33 import org.objectweb.cjdbc.scenario.templates.NoTemplate; 34 35 41 public class UTFEncodingTest extends NoTemplate 42 { 43 48 public void testCJDBCStreamsUTFEncoding() throws Exception 49 { 50 File f = new File ("test"); 51 f.deleteOnExit(); 52 53 FileOutputStream fos = new FileOutputStream (f); 54 CJDBCOutputStream output = new CJDBCOutputStream(fos); 55 56 String arigatou = "ありがとう"; 57 output.writeUTF(arigatou); 58 output.flush(); 59 output.close(); 60 61 FileInputStream fis = new FileInputStream (f); 62 CJDBCInputStream input = new CJDBCInputStream(fis); 63 String arigatouRead = input.readUTF(); 64 System.out.println(arigatouRead); 65 assertEquals(arigatou,arigatouRead); 66 } 67 } 68 | Popular Tags |