Package org.gvsig.andami
Class Utilities
java.lang.Object
org.gvsig.andami.Utilities
This class offers several general purpose method, to perform common tasks in
an easy way.
- Version:
- $Revision: 29593 $
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanComponent(Component baseComponent) Method which frees the memory from JInternalFramesprotected static voidcleanComponent(Component baseComponent, int depth) static voidCleans every temporal file previously downloaded.static ImageIconcreateImageIcon(String path) Creates an icon from an image path.static FilecreateTemp(String fileName, String data) Creates a temporary file with a the provided name and data.static StringCreates the directory for temporary files, and returns the path of this directory.static FiledownloadFile(URL url, String name) 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 voidextractTo(File file, File dir, MultiSplashWindow splash) Extracts a ZIP file in the provided directorystatic Stringstatic voidRemove an URL from the system cache.
-
Field Details
-
TEMPDIRECTORYPATH
-
-
Constructor Details
-
Utilities
public Utilities()
-
-
Method Details
-
getTempDirectory
-
cleanUpTempFiles
public static void cleanUpTempFiles()Cleans every temporal file previously downloaded. -
createTemp
Creates a temporary file with a the provided name and data. The file will be automatically deleted when the application exits.- Parameters:
fileName- Name of the temporary file to createdata- The data to store in the file- Returns:
- Throws:
IOException
-
createTempDirectory
Creates the directory for temporary files, and returns the path of this directory. If the directory already exists, it just returns its path. Any file or directory created in this special directory will be delete when the application finishes.- Returns:
- An String containing the full path to the temporary directory
-
createImageIcon
Creates an icon from an image path.- Parameters:
path- Path to the image to be loaded- Returns:
- ImageIcon if the image is found, null otherwise
-
cleanComponent
Method which frees the memory from JInternalFrames- Parameters:
baseComponent- JInternalFrame whose memory is to be freed
-
cleanComponent
-
extractTo
public static void extractTo(File file, File dir, MultiSplashWindow splash) throws ZipException, IOException Extracts a ZIP file in the provided directory- Parameters:
file- Compressed filedir- Directory to extract the filessplash- The splash window to show the extraction progress- Throws:
ZipException- If there is some problem in the file formatIOException- If there is a problem reading the file
-
downloadFile
public static File downloadFile(URL url, String name) 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:
-
removeURL
Remove an URL from the system cache. The file will remain in the file system for further eventual uses.- Parameters:
request-
-