jhplot
Class Web
- java.lang.Object
-
- jhplot.Web
-
public class Web extends java.lang.Object
Simple file downloader similar to Unix WGET. Use get(url,true) if you want to replace the existiong file. Use get(url) for downloading the file only if it does not exist on the local disk. It can also allows to load a jar file from the internet and attach it to the classpath.
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
fSep
static java.lang.String
lSep
-
Constructor Summary
Constructors Constructor and Description Web()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static jhplot.Web.WgetStatus
get(java.lang.String url)
Download a file to the local disk.static jhplot.Web.WgetStatus
get(java.lang.String url, boolean isOverwrite)
Download a file to the local disk.static jhplot.Web.WgetStatus
get(java.lang.String url, java.lang.String saveAsFile, boolean isOverwrite)
Download a file to the local disk.static java.lang.String
getCurrentPath()
Return instalation path.static java.lang.String
load(java.lang.String url2)
Download a jar file from the web and attach to the classpath.static java.lang.String
load(java.lang.String url2, boolean isOverwrite)
Download a jar file from the web and attach to the classpath.static java.lang.String
load(java.lang.String url2, java.lang.String dir, boolean isOverwrite)
Download a jar file from the web and attach to the classpath.static void
loadLibrary(java.io.File jar)
Adds the supplied Java Archive library to java.class.path.
-
-
-
Field Detail
-
fSep
public static final java.lang.String fSep
-
lSep
public static final java.lang.String lSep
-
-
Method Detail
-
get
public static jhplot.Web.WgetStatus get(java.lang.String url)
Download a file to the local disk. It assumes the current directory. If file exists locally, the file will not be overwritten.- Parameters:
url
- input URL for download.
-
get
public static jhplot.Web.WgetStatus get(java.lang.String url, boolean isOverwrite)
Download a file to the local disk. It assumes the current directory.- Parameters:
url
- input URL for download.isOverwrite
- set to true if the local file need to be replaced from the web.
-
get
public static jhplot.Web.WgetStatus get(java.lang.String url, java.lang.String saveAsFile, boolean isOverwrite)
Download a file to the local disk.- Parameters:
url
- input URL for download.saveAsFile
- file name with the path where the file will be savedisOverwrite
- set to true if the local file need to be replaced from the web.
-
load
public static java.lang.String load(java.lang.String url2)
Download a jar file from the web and attach to the classpath. The downloaded jar file will be located inside "lib/user" directory. The existing file will not trigger the download.- Parameters:
url2
- input URL of jar for download.- Returns:
- string with the status.
-
load
public static java.lang.String load(java.lang.String url2, boolean isOverwrite)
Download a jar file from the web and attach to the classpath. The downloaded jar file will be located inside "lib/user" directory of the installation.- Parameters:
url2
- input URL of jar for download.isOwerwrite
- true if the existing file needs to be replaced. Set to False if skip download in the case of existing file.- Returns:
- string with the status.
-
load
public static java.lang.String load(java.lang.String url2, java.lang.String dir, boolean isOverwrite)
Download a jar file from the web and attach to the classpath. The downloaded jar file will be located inside "dir" directory.- Parameters:
url2
- input URL of jar for download.dir
- directory path where the jar file should be storedisOwerwrite
- true if the existing file needs to be replaced. Set to False if skip download in the case of existing file.- Returns:
- string with the status.
-
loadLibrary
public static void loadLibrary(java.io.File jar) throws java.io.IOException
Adds the supplied Java Archive library to java.class.path. This is benign if the library is already loaded.- Parameters:
jar
- input file- Throws:
java.io.IOException
-
getCurrentPath
public static java.lang.String getCurrentPath()
Return instalation path.- Returns:
- installation path
-
-
DMelt 3.0 © DataMelt by jWork.ORG