Article View: borland.public.jbuilder.java.language
Article #452Re: moving files over a network
From: hu zhenghui
Date: Wed, 06 Apr 2005 07:55
Date: Wed, 06 Apr 2005 07:55
25 lines
1902 bytes
1902 bytes
> byte[] data = new byte[256];
> //Figure out how many whole 256 chunks can be had from this file.
> int Sum = ((int)myFile.length() / 256);
> for(int j = 0; j < Sum; j++)
> {
> bis.read(data);
> bos.write(data);
> bos.flush();
> final int count = (256*j);
> SwingUtilities.invokeLater(new Runnable()
> {
> public void run()
> {
> rq.ref.jProgressBar1.setValue(count);
> }
> });
> yield();
> }
> //Write the remaining bytes to the stream
> //which would be less than 256 bytes
> bis.read(data);
> bos.write(data);
remaining bytes in bis would be less than 256 bytes, but the code
"bos.write(data)" will write 256 bytes.
> bos.flush();
Technical Details
Message-ID:
<4253a38d@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4166d7bd@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,bc29b6ed7c1b7646 X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "hu zhenghui" <webmaster@huzhenghui.51.net> From: "hu zhenghui" <webmaster@huzhenghui.51.net> Newsgroups: borland.public.jbuilder.java.language References: <4166d7bd@newsgroups.borland.com> Subject: Re: moving files over a network Date: Wed, 6 Apr 2005 15:55:37 +0800 Lines: 27 Organization: hu zhenghui X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.224 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.224 NNTP-Posting-Host: 211.157.212.34 Message-ID: <4253a38d@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1112777613 211.157.212.34 (6 Apr 2005 01:53:33 -0800) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news-FFM2.ecrc.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail