Kőbányai Creative Commons License 2002.11.11 0 0 395
hello!

itt van egy pelda egy tavoli file olvasasara, garantaltan cache-elesmentesen (utobbi by Angyalhentes ;-)) )


URL remotefile;

(...)

Random ra=new Random();

(...)


try
{
remotefile=new URL(getCodeBase()+"adatok.txt"+"?kamu="+ra.nextInt(1000));

URLConnection c=null;
InputStreamReader instream;
BufferedReader data;
StringBuffer buf=new StringBuffer();
String line;

try
{
c=this.remotefile.openConnection();
c.connect();
instream=new InputStreamReader(c.getInputStream());
data=new BufferedReader(instream);

while((line=data.readLine())!=null)
{
buf.append(line+"\n");
System.out.println(line);
}
}
catch(IOException e){}
}
catch(MalformedURLException e){};

Előzmény: peestabacsi (392)