📄 filestream1.java
字号:
import java.io.*;
class FileStream1
{
public static void main(String args[])
{
File f=new File("hello.txt");
try
{
FileOutputStream out = new FileOutputStream(f);
byte buf[]="hello world".getBytes();
out.write(buf);
out.close();
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
FileInputStream in = new FileInputStream(f);
byte buf[]=new byte[1024];
int len=in.read(buf);
System.out.println(len);
in.close();
System.out.println(new String(buf,0,len));
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -