📄 readlog.java
字号:
package myseverlet;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.net.URL;
public class Readlog {
// public static void main(String[] args) {
// System.out.println("Readlog is in");
// try{
// RandomAccessFile rf = new RandomAccessFile("d:\\aa.txt","r" );
// long position = rf.length();
// rf.skipBytes((int)position + 1);
// String s1=null;
// while((s1=rf.readLine())!=null){
// System.out.println(s1);
// Thread.sleep(2000);
// }
// rf.close();
//
// System.out.println("Readlog is out");
//
// }catch (Exception e){
// System.out.println( "read error! ");
// }
// }
public void runReadlog(){
System.out.println("Readlog is in");
try{
URL urlfile = new URL("");
System.out.println("Readlog is in++1+++++++");
BufferedReader in = new BufferedReader(new InputStreamReader(urlfile.openStream()));
System.out.println("Readlog is in++2+++++++");
String line = in.readLine();
System.out.println("Readlog is in++3+++++++");
String strNews=null;
while(line!=null){
strNews += line + "<br>";
line = in.readLine();
System.out.println("line" +line);
}
in.close();
System.out.println("Readlog is out");
}catch (IOException e){
System.out.println("IOException:"+ e.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -