public class Utilities extends Object
Modifier and Type | Field and Description |
---|---|
static String |
TEMPDIRECTORYPATH |
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanComponent(Component baseComponent)
Method which frees the memory from JInternalFrames
|
protected static void |
cleanComponent(Component baseComponent,
int depth) |
static void |
cleanUpTempFiles()
Cleans every temporal file previously downloaded.
|
static ImageIcon |
createImageIcon(String path)
Creates an icon from an image path.
|
static File |
createTemp(String fileName,
String data)
Creates a temporary file with a the provided name and data.
|
static String |
createTempDirectory()
Creates the directory for temporary files, and returns the path of
this directory.
|
static File |
downloadFile(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 void |
extractTo(File file,
File dir,
MultiSplashWindow splash)
Extracts a ZIP file in the provided directory
|
static void |
removeURL(URL url)
Remove an URL from the system cache.
|
public static final String TEMPDIRECTORYPATH
public static ImageIcon createImageIcon(String path)
path
- Path to the image to be loadedpublic static void cleanComponent(Component baseComponent)
baseComponent
- JInternalFrame whose memory is to be
freedprotected static void cleanComponent(Component baseComponent, int depth)
public static void extractTo(File file, File dir, MultiSplashWindow splash) throws ZipException, IOException
file
- Compressed filedir
- Directory to extract the filessplash
- The splash window to show the extraction progressZipException
- If there is some problem in the file formatIOException
- If there is a problem reading the filepublic static File downloadFile(URL url, String name) throws IOException, ConnectException, UnknownHostException
url
- name
- IOException
ServerErrorResponseException
ConnectException
UnknownHostException
public static void cleanUpTempFiles()
public static File createTemp(String fileName, String data) throws IOException
fileName
- Name of the temporary file to createdata
- The data to store in the fileIOException
public static void removeURL(URL url)
request
- public static String createTempDirectory()