Tag archive for: Java NIO

How to download a file via HTTP GET and HTTP POST in Java without using any external libraries

Apart from uploading a file to a HTTP server endpoint, another common task for a Java HTTP client is to download a file from a HTTP server. Even though there are many Java external libraries to help us do so, using the facilities in the Java standard runtime installation is not difficult. Furthermore, we will be able to keep our Java application leaner if we can download files without additional dependencies.

In case you need a reference, this is how to download a file via HTTP GET and HTTP POST in Java without using any external libraries.