⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iodemo15.java

📁 JAVA的一些基础教程
💻 JAVA
字号:
import java.io.*;
public class IODemo15
{
   public static void main(String arg[]) throws Exception
	{
		String a = "学java,其实不难,只要你用心";
		FileOutputStream fos = new FileOutputStream("big5.html");

		OutputStreamWriter osw = new OutputStreamWriter(fos,"BIG5");
		for(int i =0; i< a.length(); i++)
			osw.write(a.charAt(i));
		osw.close();

		System.out.println("\n按系统省却编码GBK方式读文件");
		FileInputStream fis = new FileInputStream("big5.html");

		InputStreamReader isr = new InputStreamReader(fis);
		int j ;
		while((j = isr.read())!= -1)
			System.out.print((char)j);
		isr.close();

		System.out.println("\n\n按BIG5繁体编码方式读文件");
		fis = new FileInputStream("big5.html");

		isr = new InputStreamReader(fis,"BIG5");
		while((j = isr.read())!= -1)
			System.out.print((char)j);
		isr.close();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -