|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.croftsoft.core.net.Downloader
public final class Downloader
Downloads the content of a URL to a local File.
Method Summary | |
---|---|
static void |
download(InputStream unbufferedInputStream,
File destinationFile)
|
static void |
download(String urlString,
String filename)
|
static void |
download(String urlPrefix,
String filenamePrefix,
int start,
int stop)
Downloads a sequence of files ending in a number. |
static void |
download(URL url,
File dest)
Downloads the content at a URL to a local destination File. |
static InputStream |
downloadResource(URL codebaseURL,
String name)
Returns null if the codebaseURL is null. |
static boolean |
downloadResourceToDir(URL codebaseURL,
String name,
File destDir)
|
static boolean |
isValid(String sourceURLName,
String localFilename,
boolean compareContentLength,
boolean compareLastModified)
Determines if the local file is valid. |
static boolean |
isValid(URL sourceURL,
File localFile,
boolean compareContentLength,
boolean compareLastModified)
Determines if the local file is valid. |
static void |
main(String[] args)
Downloads files. |
static String |
replaceSeparators(String localPath)
Replaces every instance of File.separator with a forward slash character. |
static String |
replaceSpaces(String remoteFilename)
Replaces every instance of space (" ") with the x-www-form-urlencoded equivalent ("%20"). |
static boolean |
validate(String sourceURLName,
String localFilename,
boolean checkContentLength,
boolean checkLastModified)
Downloads a file if the local copy is missing or outdated. |
static boolean |
validate(URL sourceURL,
File localFile,
boolean checkContentLength,
boolean checkLastModified)
Downloads a file if the local copy is missing or outdated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void main(String[] args) throws Exception
if ( args.length < 4 ) { validate ( args [ 0 ], args [ 1 ], true, true ); } else { download ( args [ 0 ], args [ 1 ], Integer.parseInt ( args [ 2 ] ), Integer.parseInt ( args [ 3 ] ) ); }
Exception
public static void download(String urlPrefix, String filenamePrefix, int start, int stop) throws IOException
IOException
public static void download(String urlString, String filename) throws IOException, MalformedURLException
IOException
MalformedURLException
public static void download(URL url, File dest) throws IOException
IOException
public static void download(InputStream unbufferedInputStream, File destinationFile) throws IOException
IOException
public static boolean downloadResourceToDir(URL codebaseURL, String name, File destDir)
public static InputStream downloadResource(URL codebaseURL, String name)
public static boolean isValid(URL sourceURL, File localFile, boolean compareContentLength, boolean compareLastModified) throws IOException, ProtocolException
If both compareContentLength and compareLastModified are false, this methods simply checks for the existence of the local file.
IOException
ProtocolException
public static boolean isValid(String sourceURLName, String localFilename, boolean compareContentLength, boolean compareLastModified) throws IOException, ProtocolException
If both compareContentLength and compareLastModified are false, this methods simply checks for the existence of the local file.
sourceURLName
- An HTTP URL.
IOException
ProtocolException
public static String replaceSeparators(String localPath)
public static String replaceSpaces(String remoteFilename)
public static boolean validate(String sourceURLName, String localFilename, boolean checkContentLength, boolean checkLastModified) throws IOException, MalformedURLException
IOException
MalformedURLException
public static boolean validate(URL sourceURL, File localFile, boolean checkContentLength, boolean checkLastModified) throws IOException
IOException
|
CroftSoft Javadoc | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |