public class NetFunctions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
NetFunctions.HttpPage
Store an http formatted web page
|
Modifier and Type | Field and Description |
---|---|
static int |
CONNECTION_FAILED |
static int |
EVENT_NETLATENCY |
static int |
EVENT_URLFAILED |
static int |
EVENT_URLOK |
static int |
FILE_FAILED |
static int |
FILE_LOCAL_ISNEWER |
static int |
FILE_RETRIEVED |
static long |
LATENCY_FAIL |
static long |
LATENCY_UNKNOWN |
Constructor and Description |
---|
NetFunctions() |
Modifier and Type | Method and Description |
---|---|
long |
getLatency(java.lang.String surl,
java.net.Proxy proxy,
int timeout)
Get latency non threaded version
|
java.lang.String |
getURLContentAsString(java.lang.String sourceurl,
java.net.Socket s)
Check web for updates and return version string if an update is available
|
boolean |
isIPAddress(java.lang.String ipaddress)
Make sure ipaddress is valid number
|
java.io.InputStream |
openStreamToURL(java.lang.String surl,
java.net.Socket s)
Open an inputstream to the given url on the given socket
|
int |
saveURLContentToFile(java.lang.String destfile,
java.lang.String sourceurl,
java.net.Socket socket,
boolean force)
Save the contents of a URL to a file
|
void |
setProgressBar(javax.swing.JProgressBar jpb) |
void |
setSocketTimeout(int timeout)
Set default socket timeout
|
public static final int CONNECTION_FAILED
public static final int FILE_LOCAL_ISNEWER
public static final int FILE_RETRIEVED
public static final int FILE_FAILED
public static final int EVENT_URLOK
public static final int EVENT_URLFAILED
public static final int EVENT_NETLATENCY
public static final long LATENCY_FAIL
public static final long LATENCY_UNKNOWN
public void setSocketTimeout(int timeout)
timeout
- public void setProgressBar(javax.swing.JProgressBar jpb)
public int saveURLContentToFile(java.lang.String destfile, java.lang.String sourceurl, java.net.Socket socket, boolean force)
destfile
- File destination pathsourceurl
- URLsocket
- force
- Forces update regardless of agepublic boolean isIPAddress(java.lang.String ipaddress)
ipaddress
- public long getLatency(java.lang.String surl, java.net.Proxy proxy, int timeout)
surl
- Testing urlproxy
- Specify a proxy, null == no proxytimeout
- Specify a timeout before declaring failurepublic java.lang.String getURLContentAsString(java.lang.String sourceurl, java.net.Socket s)
sourceurl
- URL to checks
- Socketpublic java.io.InputStream openStreamToURL(java.lang.String surl, java.net.Socket s)
surl
- s
-