import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
/*
* Created on 16.06.2004
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
* @author rogo
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class CodeTest
{
public static void main(String[] args)
{
try
{
// OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream("test"),"ISO-8859-1");
// for(int i=0;i<256;++i)
// {
// writer.write((char)i);
// }
// writer.close();
FileOutputStream stream = new FileOutputStream("test");
for(int i=0;i<256;++i)
stream.write(i);
stream.close();
InputStreamReader reader = new InputStreamReader(new FileInputStream("test"),"MacCentralEurope");
char[] a = new char[256];
reader.read(a);
String text= new String(a);
// System.out.println(text);
for(int i=0;i<text.length();++i)
System.out.println(i+" "+(int)text.charAt(i)+" "+text.charAt(i));
text=Convert.normanToUnicode(text);
reader.close();
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream("test2.txt"),"UTF-8");
writer.write(text);
writer.close();
} catch (UnsupportedEncodingException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>