Package org.savantbuild.net
Class NetTools
java.lang.Object
org.savantbuild.net.NetTools
This class provides toolkit methods for helping work with URLs and URIs and other network classes.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
NetTools
public NetTools()
-
-
Method Details
-
build
Builds a URI from the given parts. These are concatenated together with slashes, depending on the endings of each.- Parameters:
parts- The parts- Returns:
- The URI.
-
downloadToPath
public static Path downloadToPath(URI uri, String username, String password, MD5 md5) throws IOException, MD5Exception Downloads the resource given.- Parameters:
uri- The resource.username- (Optional) The username that might be used to connect to the resource.password- (Optional) The password that might be used to connect to the resource.md5- (Optional) The MD5 of the resource (to verify).- Returns:
- A temp file that stores the resource or null if the given URI doesn't exist.
- Throws:
IOException- If the resource could not be downloaded.MD5Exception- If the file was downloaded but doesn't match the MD5 sum.
-