floater
Java Jedi
总版主
发贴: 3233
积分: 421
|
于 2004-02-13 05:55
1. Read HTTP/FTP specs 2. If you don't have extensive experience on programming, start with something small, just like the reference you mentioned, but just a single thread. Make it work, then expand it out. 3. If you do believe you are good enough, looks at the ftp tools available on the net, like cuteftp, leapftp, flashftp, ... see what kind of features they have and you may think about how they do it. There are features like multi protocols, firewall/proxy settings, transfer types, resumed downloading, etc. 4. In the reference above, the coding is very primitive in the following(it's pretty old): a. FileAccessI class shouldn't implement Serializable at all, not point to do so. b. did not seperate local disk writing from net downloading code. c. should seperate out the thread handling from the rest. d. I don't see the point why SiteFileFetch needs to inherit from Thread, either from coding or requirements. e. HttpURLConnection and URLConnection have better ways to deal with headers, and others.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler, Refactoring - Improving the Design of Existing Code
|