String path="G:/test.txt";
File file = new File(path); // 要讀取以上路徑的input。txt文件
System.out.println(file.getName());
byte[] bytes = new byte[1024];
StringBuffer sb = new StringBuffer();
FileInputStream in = new FileInputStream(file);
int len;
while ((len = in.read(bytes)) != -1) {
sb.append(new String(bytes, 0, len));
}
System.out.println(sb.toString());