📄 例13.txt
字号:
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
public class Example9_13{
public static void main(String args[]){
int b;
byte tom[]=new byte[12];
try{ RandomAccessFile input=new RandomAccessFile("Example9_1.java","rw");
FileChannel channel=input.getChannel();
while((b=input.read(tom,0,10))!=-1){
FileLock lock=channel.tryLock();
String s=new String (tom,0,b);
System.out.print(s);
try { Thread.sleep(1000);
lock.release();
}
catch(Exception eee){
System.out.println(eee);
}
}
input.close();
}
catch(Exception ee){
System.out.println(ee);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -