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