org.expasy.minitools.util
Class FileUtils

java.lang.Object
  extended by org.expasy.minitools.util.FileUtils

public class FileUtils
extends java.lang.Object

Title: FileUtils
Description:
Copyright: Copyright (c) 2003
Company: SIB
Date: 24 avr. 2003
Time: 13:53:32

Version:
1.0
Author:
Celine Hernandez (chernand)

Field Summary
static java.lang.String ALDENTE_PROJECT_EXTENSION
          Extension for aldente project files (*.prj)
 
Method Summary
static void addConstraints(java.awt.GridBagConstraints c, int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int ipadx, int ipady, int fill, int anchor)
          Add contraints to the display of an element in a panel using GridBagLayout.
static java.io.InputStream findFileAsStream(java.lang.String name)
          Similar to the findImage method, but dedicated to files.
static javax.swing.ImageIcon findImage(java.lang.String name)
          Finds an image using different methods to retrieve its location: first java.net.URL url = UIManager.class.getResource("../..
static java.net.URL findImagePath(java.lang.String name)
          Similar to the findImage method, but dedicated to files.
static java.lang.String getExtension(java.io.File f)
          Get the extension of a file.
static boolean isInJar()
          Test is the executed application has been zipped in a jar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALDENTE_PROJECT_EXTENSION

public static final java.lang.String ALDENTE_PROJECT_EXTENSION
Extension for aldente project files (*.prj)

See Also:
Constant Field Values
Method Detail

findImage

public static javax.swing.ImageIcon findImage(java.lang.String name)
Finds an image using different methods to retrieve its location: first java.net.URL url = UIManager.class.getResource("../../images/name.gif"); then java.net.URL url = ClassLoader.getSystemClassLoader().getResource("images/name.gif");

Parameters:
name - The name of the image.
Returns:
The image found, or null if not found.

findImagePath

public static java.net.URL findImagePath(java.lang.String name)
Similar to the findImage method, but dedicated to files. This method is not effective when trying to retrieve files in jar archives, as they do not exist any more as "files". In that case, use findFileAsStream instead. Have to replace '%20' in the url by space characters.

Parameters:
name - Name of the file to find.
Returns:
The desired file if found, or null.

findFileAsStream

public static java.io.InputStream findFileAsStream(java.lang.String name)
Similar to the findImage method, but dedicated to files. This method is effective when trying to retrieve files between system files AND in jar archives.

Parameters:
name - Name of the file to find.
Returns:
The desired file if found, or null.

isInJar

public static boolean isInJar()
Test is the executed application has been zipped in a jar.

Returns:

getExtension

public static java.lang.String getExtension(java.io.File f)
Get the extension of a file.


addConstraints

public static void addConstraints(java.awt.GridBagConstraints c,
                                  int gridx,
                                  int gridy,
                                  int gridwidth,
                                  int gridheight,
                                  double weightx,
                                  double weighty,
                                  int ipadx,
                                  int ipady,
                                  int fill,
                                  int anchor)
Add contraints to the display of an element in a panel using GridBagLayout.

Parameters:
c - The constraints object containing all the informations to use.
gridx - Location on the x-axis (up-left hand corner of the element).
gridy - Location on the y-axis (up-left hand corner of the element).
gridwidth -
gridheight -
weightx -
weighty -
ipadx -
ipady -
fill -
anchor - Place of the element in the case of grid (east, west, north, south, center)