📄 outputstreamtest.java
字号:
import java.io.*;
import java.awt.*;
import java.awt.event.*;
public class OutputStreamTest
{
static Frame f=new Frame("测试输入流");
public static void main(String[] args)
{
int b;
TextArea text=new TextArea(30,60);
byte butter[]=new byte[2500];
f.setSize(100,100);
f.setVisible(true);
f.add(text);
f.pack();
f.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{f.setVisible(false);System.exit(0);}
}
);
try
{
File file=new File("OutputStreamTest.java");
FileInputStream readfile=new FileInputStream(file);
while((b=readfile.read(butter,0,2500))!=-1)
{
String str=new String(butter,0,2500);
System.out.println(str);
text.append(str+'\n');
}
readfile.close();
}
catch(IOException e)
{System.out.println("File read error");}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -