Skip to main content
Quan Tran's user avatar
Quan Tran's user avatar
Quan Tran's user avatar
Quan Tran
  • Member for 8 years, 4 months
  • Last seen more than a month ago
awarded
awarded
awarded
comment
File downloader using Java, multithreading and HTTP Range request
3. The reason I created the Progress object in the Main class, then use it in the Download and DownloadThread objects is because I want the Main class to handle all the information printing and stuff (since I want to make a GUI program at first, and doing all the printing in one class would make it easier to move them to a FXML Controller class). Btw, should I make a GUI program then? It would be really nice, but what I want now is to make the command line program as good as possible first, then make a GUI program based on the later. What do you think?
comment
File downloader using Java, multithreading and HTTP Range request
5. Further considerations: I didn't think about that at all, that was really interesting. For the byte array, how about putting it in a synchronized block? And where should the byte array be? In the Download class? How can I access it from a DownloadThread object?
comment
File downloader using Java, multithreading and HTTP Range request
3.Logical Issues: That was because I intend to make this a GUI program, handling many downloads at once. But I'm currently just doing the command line version first, since wget is pretty slow (although quite useful) so I'm using this as a replacement. 4. wait and notify: I was learning from a beginner book when I did this. I'm learning more about those Java concurrent utils, and I will refactor the code accordingly.
comment
File downloader using Java, multithreading and HTTP Range request
1. Naming convention, access level, exception handling: Yep, those parts was stupid and lazy, I will change them. The naming convention was from C++ (as I have C++ background) btw. 2. Refactor synchronized progress logic: What you showed was awesome, I didn't think of defining an interface then use lambda expression for the actual content of the function.
awarded
awarded
revised
Loading…
awarded
Loading…