Class Utilities

java.lang.Object
org.gvsig.andami.Utilities

public class Utilities extends Object
This class offers several general purpose method, to perform common tasks in an easy way.
Version:
$Revision: 29593 $
  • Field Details

    • TEMPDIRECTORYPATH

      public static final String TEMPDIRECTORYPATH
  • Constructor Details

    • Utilities

      public Utilities()
  • Method Details

    • getTempDirectory

      public static String getTempDirectory()
    • cleanUpTempFiles

      public static void cleanUpTempFiles()
      Cleans every temporal file previously downloaded.
    • createTemp

      public static File createTemp(String fileName, String data) throws IOException
      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 create
      data - The data to store in the file
      Returns:
      Throws:
      IOException
    • createTempDirectory

      public static String 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

      public static ImageIcon createImageIcon(String path)
      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

      public static void cleanComponent(Component baseComponent)
      Method which frees the memory from JInternalFrames
      Parameters:
      baseComponent - JInternalFrame whose memory is to be freed
    • cleanComponent

      protected static void cleanComponent(Component baseComponent, int depth)
    • 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 file
      dir - Directory to extract the files
      splash - The splash window to show the extraction progress
      Throws:
      ZipException - If there is some problem in the file format
      IOException - 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

      public static void removeURL(URL url)
      Remove an URL from the system cache. The file will remain in the file system for further eventual uses.
      Parameters:
      request -