| java.lang.Object snow.utils.NetUtils
NetUtils | final public class NetUtils (Code) | | TODO: create ftp folder(s) if needed
TODO: list ftp folder contents
|
Method Summary | |
public static void | analyseFile(URL url) | public static void | download(URL url, File dest) Can be used for ftp, http, ... | public static void | downloadFileFromServer(URL url, File dest, String fileNameForUI, ProgressModalDialog pmd) | public static String | encode(String s, boolean flag) To encode the password to be able to pass it in the ftp url as ftp://user:pass@url . | public static String | formatNetSpeed(long sizeInByte, long timeMillis) Using the bits/s standard network unit. | public static long[] | getDateAndSizeOnServer(URL url) {date, size}. | public static boolean | guessTypeIsBinary(File f) | public static String | listFTP(String address, String user, String pass) NOT WORKING !!
Please use apache commons for this.
there are up to 8 various LIST syntax . | public static void | publishFTP(File source, String host, String user, String pass, ProgressModalDialog pmd, long alreadySend, long totalSizeToSend) | public static void | publishFTP_(File source, String host, String user, String pass, boolean binary, ProgressModalDialog pmd, long alreadySend0, long totalSizeToSend) Publish the file source on an ftp site.
Limitation: the destination folder must already exist !
Limitation: uses the embedded sun.net.ftp that is NOT supported...
Parameters: binary - can be always true, so we are sure we transfer the same bytes, without some linefeed conversions. Parameters: host - contains the destination, including file name. | public static void | writeToFile(InputStream is, File file, ProgressModalDialog pmd, long totSize) |
analyseFile | public static void analyseFile(URL url) throws Exception(Code) | | head examples:
{Expires=[Thu, 01 Jan 1970 00:00:00 GMT], Set-Cookie=[JSESSIONID=aMOvePdy_cY5; path=/], null=[HTTP/1.1 200 OK], Date=[Wed, 03 Jan 2007 15:13:51 GMT], Pragma=[no-cache], Server=[Resin/2.1.9], Content-Type=[text/html], Transfer-Encoding=[chunked], Cache-Control=[no-store]}
{Content-Length=[55024], Connection=[keep-alive], Expires=[Wed, 03 Jan 2007 16:34:17 GMT], ETag=["ef80e5db-01010001"], Date=[Wed, 03 Jan 2007 16:19:17 GMT], Server=[Apache], Content-Type=[text/html; charset=ISO-8859-1], X-Cache=[HIT from www.sunrise.ch], Last-Modified=[Wed, 03 Jan 2007 13:03:12 GMT], Age=[366], null=[HTTP/1.0 200 OK]}
|
encode | public static String encode(String s, boolean flag)(Code) | | To encode the password to be able to pass it in the ftp url as ftp://user:pass@url .
Because often, "@" is part of the password on anonymous logon that requires a login with a valid mail adress.
|
formatNetSpeed | public static String formatNetSpeed(long sizeInByte, long timeMillis)(Code) | | Using the bits/s standard network unit.
|
getDateAndSizeOnServer | public static long[] getDateAndSizeOnServer(URL url) throws Exception(Code) | | {date, size}. Don't look too much at the size, it can be zero behind some proxies.
|
guessTypeIsBinary | public static boolean guessTypeIsBinary(File f)(Code) | | true except for well known ascii types. |
listFTP | public static String listFTP(String address, String user, String pass)(Code) | | NOT WORKING !!
Please use apache commons for this.
there are up to 8 various LIST syntax . horrible...
|
publishFTP_ | public static void publishFTP_(File source, String host, String user, String pass, boolean binary, ProgressModalDialog pmd, long alreadySend0, long totalSizeToSend) throws Exception(Code) | | Publish the file source on an ftp site.
Limitation: the destination folder must already exist !
Limitation: uses the embedded sun.net.ftp that is NOT supported...
Parameters: binary - can be always true, so we are sure we transfer the same bytes, without some linefeed conversions. Parameters: host - contains the destination, including file name. The directory must exist !!! |
|
|