package test;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
public class openFile {
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();
while (inputLine != null){
content += inputLine ;
inputLine = in.readLine();
}
System.out.println(content);
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) {
openFile of = new openFile();
String romatefilename = "file:IPADDRESS/share/test.txt";
of.readRomateFile(romatefilename);
}
}