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

📄 charactertest.java

📁 《JSP通用模块及典型系统开发实例导航》源代码
💻 JAVA
字号:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.UnsupportedEncodingException;

public class CharacterTest {
	public static String readFile(String fileName) {
		try {
			BufferedReader fr = new BufferedReader(new FileReader(fileName));
			StringBuffer out = new StringBuffer();
			String thisLine = new String();
			while ((thisLine = fr.readLine()) != null) {
				out.append(thisLine);
			}
			fr.close();
			return out.toString();
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

	public static String getString() {
		String out = readFile("E:\\wangxining\\projects\\jsptutorial\\eclipse\\workspace\\HelloWorldProject\\HelloWorldProject\\JavaSource\\text.txt");
		try {
			out = new String(out.getBytes("Gb18030"), "utf-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return out;
	}

	public static void main(String args[]) {
		String out = readFile("E:\\wangxining\\projects\\jsptutorial\\eclipse\\workspace\\HelloWorldProject\\HelloWorldProject\\JavaSource\\text.txt");
		try {
			out = new String(out.getBytes("Gb18030"), "utf-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("[" + out + "]");
	}
}

⌨️ 快捷键说明

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