package rtUtil;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
public class Test {
public void readRomateFile(String romatefilename){
URL urlfile;
BufferedReader in;
PrintWriter out;
String content = "";
String inputLine;
try{
urlfile = new URL(romatefilename);
in = new BufferedReader(new InputStreamReader(urlfile.openStream()));
inputLine = in.readLine();
int i=0;
while (inputLine != null){
content += inputLine ;
inputLine = in.readLine();
i++;
}
System.out.println(i);
in.close();
} catch (MalformedURLException e){
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @param args
*/
public static void main(String[] args) {
Test of = new Test();
String romatefilename = "file:192.168.*.*//Log/*.log";
of.readRomateFile(romatefilename);
}
}
忘记啥时候的代码了。。。如有侵权,请联系。