Revision 11996 trunk/frameworks/_fwAndami/src/com/iver/andami/Utilities.java
Utilities.java | ||
---|---|---|
1 | 1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
2 | 2 |
* |
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
3 |
* Copyright (C) 2004-2007 IVER T.I. and Generalitat Valenciana.
|
|
4 | 4 |
* |
5 | 5 |
* This program is free software; you can redistribute it and/or |
6 | 6 |
* modify it under the terms of the GNU General Public License |
... | ... | |
71 | 71 |
|
72 | 72 |
|
73 | 73 |
/** |
74 |
* Clase de utilidad |
|
74 |
* This class offers several general purpose method, to perform common |
|
75 |
* tasks in an easy way. |
|
75 | 76 |
* |
76 | 77 |
* @version $Revision$ |
77 | 78 |
*/ |
... | ... | |
86 | 87 |
|
87 | 88 |
|
88 | 89 |
/** |
89 |
* Crea un icono a partir del path de una imagen
|
|
90 |
* Creates an icon from an image path.
|
|
90 | 91 |
* |
91 |
* @param path Path de la imagen dentro del jar de la aplicaci?n
|
|
92 |
* @param path Path to the image to be loaded
|
|
92 | 93 |
* |
93 |
* @return ImageIcon si encuentra la imagen y null si no la encuentra
|
|
94 |
* @return ImageIcon if the image is found, null otherwise
|
|
94 | 95 |
*/ |
95 | 96 |
public static ImageIcon createImageIcon(String path) { |
96 | 97 |
URL imgURL = null; |
... | ... | |
109 | 110 |
} |
110 | 111 |
|
111 | 112 |
/** |
112 |
* M?todo que libera la memoria de los jInternalFrame
|
|
113 |
* Method which frees the memory from JInternalFrames
|
|
113 | 114 |
* |
114 |
* @param baseComponent JInternalFrame cuya memoria se quiere eliminar |
|
115 |
* @param baseComponent JInternalFrame whose memory is to be |
|
116 |
* freed |
|
115 | 117 |
*/ |
116 | 118 |
public static void cleanComponent(Component baseComponent) { |
117 | 119 |
try { |
... | ... | |
172 | 174 |
|
173 | 175 |
|
174 | 176 |
/** |
175 |
* Extrae un fichero zip en un directorio
|
|
177 |
* Extracts a ZIP file in the provided directory
|
|
176 | 178 |
* |
177 |
* @param file fichero comprimido |
|
178 |
* @param dir Directorio donde se extraera el fichero |
|
179 |
* @param file Compressed file |
|
180 |
* @param dir Directory to extract the files |
|
181 |
* @param splash The splash window to show the extraction progress |
|
179 | 182 |
* |
180 |
* @throws ZipException Si hay un error con el formato del fichero
|
|
181 |
* @throws IOException Si se produce un error de entrada salida gen?rico
|
|
183 |
* @throws ZipException If there is some problem in the file format
|
|
184 |
* @throws IOException If there is a problem reading the file
|
|
182 | 185 |
*/ |
183 | 186 |
public static void extractTo(File file, File dir, MultiSplashWindow splash) |
184 | 187 |
throws ZipException, IOException { |
... | ... | |
349 | 352 |
} |
350 | 353 |
|
351 | 354 |
/** |
352 |
* Crea un fichero temporal con un nombre concreto y unos datos pasados por |
|
353 |
* par?metro. |
|
354 |
* @param fileName Nombre de fichero |
|
355 |
* @param data datos a guardar en el fichero |
|
355 |
* Creates a temporary file with a the provided name and data. The file |
|
356 |
* will be automatically deleted when the application exits. |
|
357 |
* |
|
358 |
* @param fileName Name of the temporary file to create |
|
359 |
* @param data The data to store in the file |
|
356 | 360 |
*/ |
357 |
public static void createTemp(String fileName, String data)throws IOException{
|
|
361 |
public static File createTemp(String fileName, String data)throws IOException{
|
|
358 | 362 |
File f = new File(fileName); |
359 | 363 |
DataOutputStream dos = new DataOutputStream( new BufferedOutputStream(new FileOutputStream(f)) ); |
360 | 364 |
dos.writeBytes(data); |
361 | 365 |
dos.close(); |
362 | 366 |
f.deleteOnExit(); |
367 |
return f; |
|
363 | 368 |
} |
364 | 369 |
|
365 | 370 |
/** |
... | ... | |
373 | 378 |
} |
374 | 379 |
|
375 | 380 |
/** |
376 |
* Esta funci?n crea el directorio para temporales y devuelve el nombre de este para que cualquier |
|
377 |
* extensi?n en gvSIG pueda utilizar este directorio para guardar ficheros que se desee eliminar |
|
378 |
* al salir |
|
379 |
* @return |
|
381 |
* Creates the directory for temporary files, and returns the path of |
|
382 |
* this directory. If the directory already exists, it just returns |
|
383 |
* its path. Any file or directory created in this special directory |
|
384 |
* will be delete when the application finishes. |
|
385 |
* |
|
386 |
* @return An String containing the full path to the temporary directory |
|
380 | 387 |
*/ |
381 | 388 |
public static String createTempDirectory(){ |
382 | 389 |
File tempDirectory = new File(TEMPDIRECTORYPATH); |
Also available in: Unified diff