public class Utilities
extends java.lang.Object
| Constructor and Description |
|---|
Utilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
cleanUpTempFiles()
Cleans every temporal file previously downloaded.
|
static void |
createTemp(java.lang.String fileName,
java.lang.String data)
Crea un fichero temporal con un nombre concreto y unos datos pasados por
parámetro.
|
static java.util.Vector |
createVector(java.lang.String str,
java.lang.String c)
Parses the String containing different items [character] separated and
creates a vector with them.
|
static java.io.File |
downloadFile(java.net.URL url,
java.lang.String name,
ICancellable cancel)
Downloads an URL into a temporary file that is removed the next time the
tempFileManager class is called, which means the next time gvSIG is launched.
|
static java.io.File |
downloadFile(java.net.URL url,
java.lang.String data,
java.lang.String name,
ICancellable cancel)
Downloads a URL using the HTTP Post protocol
|
static java.io.File |
downloadFile(java.net.URL url,
java.lang.String data,
java.lang.String name,
ICancellable cancel,
int maxbytes) |
static byte[] |
eliminarDTD(byte[] bytes,
java.lang.String startTag)
Elimina del xml la declaración del DTD
|
static java.lang.String |
getAbsolutePathOrEmpty(java.io.File f) |
static boolean |
isNumber(java.lang.String s)
Checks if a String is a number or not
|
static boolean |
isTextData(byte[] data)
Deprecated.
|
static boolean |
isTextFile(java.io.File file)
Checks a File and tries to figure if the file is a text or a binary file.
|
static boolean |
isTextFile(java.io.File file,
int byteAmount)
Checks a File and tries to figure if the file is a text or a binary file.
|
static boolean |
isValidVersion(java.lang.String version) |
static void |
removeURL(java.lang.Object url)
Remove an URL from the system cache.
|
static void |
removeURL(java.net.URL url)
Remove an URL from the system cache.
|
static void |
serializar(java.io.InputStream in,
java.io.OutputStream out)
Copia el contenido de un InputStream en un OutputStream
|
static java.lang.String |
Vector2CS(java.util.Vector v)
Converts the contents of a Vector to a comma separated list
|
static java.lang.String |
Vector2URLParamString(java.util.Vector v) |
public static boolean isTextFile(java.io.File file)
file - public static boolean isTextFile(java.io.File file,
int byteAmount)
file - byteAmount, - number of bytes to check.public static boolean isTextData(byte[] data)
file - public static void serializar(java.io.InputStream in,
java.io.OutputStream out)
in - InputStreamout - OutputStreampublic static byte[] eliminarDTD(byte[] bytes,
java.lang.String startTag)
bytes - bytes del fichero XML de respuesta a getCapabilitiesstartTag - Tag raiz del xml respuesta a getCapabilitiespublic static java.lang.String Vector2CS(java.util.Vector v)
public static boolean isValidVersion(java.lang.String version)
public static void createTemp(java.lang.String fileName,
java.lang.String data)
throws java.io.IOException
fileName - Nombre de ficherodata - datos a guardar en el ficherojava.io.IOExceptionpublic static boolean isNumber(java.lang.String s)
String, - spublic static java.util.Vector createVector(java.lang.String str,
java.lang.String c)
str - String contains item1[c]item2[c]item3...c - is the string value for separating the itemspublic static java.lang.String Vector2URLParamString(java.util.Vector v)
dimensions - public static java.io.File downloadFile(java.net.URL url,
java.lang.String name,
ICancellable cancel)
throws java.io.IOException,
java.net.ConnectException,
java.net.UnknownHostException
url - name - java.io.IOExceptionServerErrorResponseExceptionjava.net.ConnectExceptionjava.net.UnknownHostExceptionpublic static java.io.File downloadFile(java.net.URL url,
java.lang.String data,
java.lang.String name,
ICancellable cancel)
throws java.io.IOException,
java.net.ConnectException,
java.net.UnknownHostException
url - The server URLdata - The data to send in the requestname - A common name for all the retrieved filescancel - Used to cancel the downloadsjava.io.IOExceptionjava.net.ConnectExceptionjava.net.UnknownHostExceptionpublic static java.io.File downloadFile(java.net.URL url,
java.lang.String data,
java.lang.String name,
ICancellable cancel,
int maxbytes)
throws java.io.IOException,
java.net.ConnectException,
java.net.UnknownHostException
java.io.IOExceptionjava.net.ConnectExceptionjava.net.UnknownHostExceptionpublic static void cleanUpTempFiles()
public static void removeURL(java.net.URL url)
request - public static void removeURL(java.lang.Object url)
request - public static java.lang.String getAbsolutePathOrEmpty(java.io.File f)