pakai streaming file

penggalannya


   // Open file and seek to the end of it.
      file = new RandomAccessFile(getFileName(url), "rw");
      file.seek(downloaded);

      stream = connection.getInputStream();
      while (status == DOWNLOADING) {
        /*
         * Size buffer according to how much of the file is left to
download.
         */
        byte buffer[];
        if (size - downloaded > MAX_BUFFER_SIZE) {
          buffer = new byte[MAX_BUFFER_SIZE];
        } else {
          buffer = new byte[size - downloaded];
        }

        // Read from server into buffer.
        int read = stream.read(buffer);
        if (read == -1)
          break;

        // Write buffer to file.
        file.write(buffer, 0, read);
        downloaded += read;
        stateChanged();
      }

lengkapnya bisa lihat disini:
http://www.java2s.com/Code/Java/Tiny-Application/FileDownloadManager.htm


atau mau cari sample lain
http://www.google.com/custom?q=download&sa=Search+in+Java&cof=S%3Ahttp%3A%2F%2Fwww.java2s.com&domains=www.java2s.com%2FCode%2FJava%2F&sitesearch=www.java2s.com%2FCode%2FJava%2F
http://www.google.com/custom?hl=id&cof=S%3Ahttp%3A%2F%2Fwww.java2s.com%3B&domains=www.java2s.com%2FCode%2FJava%2F&q=download+attachment&btnG=Telusuri&sitesearch=www.java2s.com%2FCode%2FJava%2F
-- 
.: Bram Andrian :.

On 5/1/07, Bayu Priyambadha <[EMAIL PROTECTED]> wrote:
>
>   Saya bikin aplikasi mail client pake java+javamail. Ada sedikit masalah
> pada pendownload-an attachement file, untuk pengiriman dah berhasil. Lha
> giliran mau didownload ndak tau caranya, gmana ya caranaya? Ada yang tau?
> Mohon bantuannya.....
>
> regard
> joe
>
> .
>
> 
>


[Non-text portions of this message have been removed]



================> HAPUS IKLAN DIATAS DAN FOOTER INI JIKA ME-REPLY 
<================
Posting   : [email protected]
Archive   : http://www.mail-archive.com/[email protected]/
                www.mitek.unibraw.ac.id || himamitek.brawijaya.ac.id
************************************************************************************
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/mitek/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/mitek/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Kirim email ke