📄 readfiletest.java
字号:
import java.io.*;
class ReadFileTest
{
public static void main(String args[])
{
int b;
byte buffer[]=new byte[2500];
try
{
FileInputStream readfile=new FileInputStream("Testfile.txt");
b=readfile.read(buffer, 0, 2500);
try
{
String str=new String(buffer, 0, b, "Default");
System.out.println(str);
}
catch(UnsupportedEncodingException e)
{
System.out.println(" the encoding was not found:"+e);
}
}
catch(IOException e)
{
System.out.println("File read Error ");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -