Package org.gvsig.remoteclient.utils
Class Utilities
java.lang.Object
org.gvsig.remoteclient.utils.Utilities
Clase con métodos de utilidad en el protocolo WMS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCleans every temporal file previously downloaded.static voidcreateTemp(String fileName, String data) Crea un fichero temporal con un nombre concreto y unos datos pasados por parámetro.static VectorcreateVector(String str, String c) Parses the String containing different items [character] separated and creates a vector with them.static FiledownloadFile(URL url, String data, String name, org.gvsig.compat.net.ICancellable cancel) Downloads a URL using the HTTP Post protocolstatic FiledownloadFile(URL url, String data, String name, org.gvsig.compat.net.ICancellable cancel, int maxbytes) static FiledownloadFile(URL url, String name, org.gvsig.compat.net.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 byte[]eliminarDTD(byte[] bytes, String startTag) Elimina del xml la declaración del DTDstatic Stringstatic booleanChecks if a String is a number or notstatic booleanisTextData(byte[] data) Checks a byte array and tells if it contains only text or contains any binary data.static booleanisTextFile(File file) Checks a File and tries to figure if the file is a text or a binary file.
Keep in mind that binary files are those that contains at least one non-printable character.static booleanisTextFile(File file, int byteAmount) Checks a File and tries to figure if the file is a text or a binary file.
Keep in mind that binary files are those that contains at least one non-printable character.static booleanisValidVersion(String version) static voidRemove an URL from the system cache.static voidRemove an URL from the system cache.static voidserializar(InputStream in, OutputStream out) Copia el contenido de un InputStream en un OutputStreamstatic StringConverts the contents of a Vector to a comma separated liststatic String
-
Constructor Details
-
Utilities
public Utilities()
-
-
Method Details
-
isTextFile
Checks a File and tries to figure if the file is a text or a binary file.
Keep in mind that binary files are those that contains at least one non-printable character.- Parameters:
file-- Returns:
- true when the file is pretty problably text, false if the file is binary.
-
isTextFile
Checks a File and tries to figure if the file is a text or a binary file.
Keep in mind that binary files are those that contains at least one non-printable character.- Parameters:
file-byteAmount- , number of bytes to check.- Returns:
- true when the file is pretty problably text, false if the file is binary.
-
isTextData
public static boolean isTextData(byte[] data) Checks a byte array and tells if it contains only text or contains any binary data.- Parameters:
file-- Returns:
- true when the data is only text, false otherwise.
-
serializar
Copia el contenido de un InputStream en un OutputStream- Parameters:
in- InputStreamout- OutputStream
-
eliminarDTD
Elimina del xml la declaración del DTD- Parameters:
bytes- bytes del fichero XML de respuesta a getCapabilitiesstartTag- Tag raiz del xml respuesta a getCapabilities- Returns:
- bytes del fichero XML sin la declaración del DTD
-
Vector2CS
Converts the contents of a Vector to a comma separated list -
isValidVersion
-
createTemp
Crea un fichero temporal con un nombre concreto y unos datos pasados por parámetro.- Parameters:
fileName- Nombre de ficherodata- datos a guardar en el fichero- Throws:
IOException
-
isNumber
Checks if a String is a number or not- Parameters:
String- , s- Returns:
- boolean, true if s is a number
-
createVector
Parses the String containing different items [character] separated and creates a vector with them.- Parameters:
str- String contains item1[c]item2[c]item3...c- is the string value for separating the items- Returns:
- Vector containing all the items
-
Vector2URLParamString
- Parameters:
dimensions-- Returns:
-
downloadFile
public static File downloadFile(URL url, String name, org.gvsig.compat.net.ICancellable cancel) throws IOException, ConnectException, UnknownHostException 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.- Parameters:
url-name-- Returns:
-
downloadFile
public static File downloadFile(URL url, String data, String name, org.gvsig.compat.net.ICancellable cancel) throws IOException, ConnectException, UnknownHostException Downloads a URL using the HTTP Post protocol- Parameters:
url- The server URLdata- The data to send in the requestname- A common name for all the retrieved filescancel- Used to cancel the downloads- Returns:
- The retrieved file
- Throws:
IOExceptionConnectExceptionUnknownHostException
-
downloadFile
public static File downloadFile(URL url, String data, String name, org.gvsig.compat.net.ICancellable cancel, int maxbytes) throws IOException, ConnectException, UnknownHostException -
cleanUpTempFiles
public static void cleanUpTempFiles()Cleans every temporal file previously downloaded. -
removeURL
Remove an URL from the system cache. The file will remain in the file system for further eventual uses.- Parameters:
request-
-
removeURL
Remove an URL from the system cache. The file will remain in the file system for further eventual uses.- Parameters:
request-
-
getAbsolutePathOrEmpty
-