• Web sitemizin içeriğine ve tüm hizmetlerimize erişim sağlamak için Web sitemize kayıt olmalı ya da giriş yapmalısınız. Web sitemize üye olmak tamamen ücretsizdir.
  • Sohbetokey.com ile canlı okey oynamaya ne dersin? Hem sohbet et, hem mobil okey oyna!
  • Soru mu? Sorun mu? ''Bir Sorum Var?'' sistemimiz aktiftir. Paylaşın beraber çözüm üretelim.

[Java] Dosya Indirici | BarisJKaraali | [Source]

Üyelik Tarihi
7 Ocak 2015
Konular
4,091
Mesajlar
4,274
MFC Puanı
40
Kod:
import java.io.*; 
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. */ 
} 
}
 
Üst