Hızlı Konu Açma

Hızlı Konu Açmak için tıklayınız.

Son Mesajlar

Konulardaki Son Mesajlar

Reklam

Forumda Reklam Vermek İçin Bize Ulaşın

[Java] Dosya Indirici

BlackKey

Üye
Fenerbahçe
Kayıtlı Üye
Katılım
12 Eylül 2014
Mesajlar
167
Tepkime puanı
0
Puanları
0
Kod:
[B]import java.io.*; [/B][COLOR=DarkOrange][B]import java.net.*; 
public class SampleFile 
{ 
public static **** main(String args[]) throws IOException 
{ 

java.io.BufferedInputStream in = new java.io.BufferedInputStream(new java.net.URL("http://www.yoururlhere.com/file.exe").openStream()); 
/* We are creating a input stream to the website where the file is located. */ 
java.io.FileOutputStream fos = new java.io.FileOutputStream("file.exe"); 
/* Creating a filestream to write the downloaded bytes to a file */ 
java.io.BufferedOutputStream bout = new BufferedOutputStream(fos,1024); 
byte data[] = new byte[1024]; 
while(in.read(data,0,1024)>=0) 
{ 
bout.write(data); 
} 
/* In the loop we are reading the file from the website by 1 KB intervals */ 
bout.close(); 
in.close(); 
/* Closing our streams. */ 
}  [/B][/COLOR][B]} [/B]
 

Users Who Are Viewing This Konu (Users: 0, Guests: 1)

Üst