?? randomread.java
字號:
//randomRead.Java
import java.io.*;
public class randomRead
{
public static void main(String args[]) throws IOException{
System.out.println("Please enter a directory that the file located in:");
StringBuffer stfDir = new StringBuffer();
char ch;
while(( ch=(char) System.in.read())!='\n')
{
stfDir.append(ch);
}
File dir = new File(stfDir.toString());
System.out.println("Please enter a filename that want to read:");
StringBuffer stfFilename = new StringBuffer();
char c;
while((c = (char)System.in.read())!='\n')
{
stfFilename.append(ch);
}
File readFrom = new File(dir,stfFilename.toString());
if(readFrom.isFile() && readFrom.canWrite() && readFrom.canRead())
{
RandomAccessFile rafFile =new RandomAccessFile(readFrom,"rw");
while(rafFile.getFilePointer()<rafFile.length())
System.out.println(rafFile.readLine());
rafFile.close();
}
else
System.out.println("File cann't be read!");
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -