Class I18nUtil

java.lang.Object
org.nuiton.i18n.I18nUtil

public class I18nUtil extends Object
Author:
Tony Chemit - chemit@codelutin.com
  • Field Details

    • ISO_8859_1_ENCODING

      public static final String ISO_8859_1_ENCODING
      See Also:
    • UTF_8_ENCODING

      public static final String UTF_8_ENCODING
      See Also:
    • DEFAULT_ENCODING

      public static final String DEFAULT_ENCODING
      See Also:
    • DEFAULT_CHARSET

      public static final Charset DEFAULT_CHARSET
    • DEFAULT_MESSAGE_FORMATTER

      public static final I18nMessageFormatter DEFAULT_MESSAGE_FORMATTER
    • DEFAULT_LOCALE

      public static final Locale DEFAULT_LOCALE
    • EMPTY_STRING_ARRAY

      public static final String[] EMPTY_STRING_ARRAY
    • LOCALE_CONVERTER

      public static final org.nuiton.converter.LocaleConverter LOCALE_CONVERTER
  • Constructor Details

    • I18nUtil

      public I18nUtil()
  • Method Details

    • parseLocales

      public static Locale[] parseLocales(String str) throws IllegalArgumentException
      Parse a list of Locale seperated by comma. Example : fr_FR,en_GB
      Parameters:
      str - the string representation of locale separated by comma
      Returns:
      list of available locales
      Throws:
      IllegalArgumentException - ia a locale is not valid
    • newLocale

      public static Locale newLocale(String str)
    • newLocale

      public static Locale newLocale(String language, String country)
    • containsDirectDirectory

      public static boolean containsDirectDirectory(URL url, String directory) throws IOException
      Test if an url contains the given directory with no recurse seeking.
      Parameters:
      url - the url to seek
      directory - the directory to find
      Returns:
      true if directory was found, false otherwise.
      Throws:
      IOException - if any io pb
    • isJar

      public static boolean isJar(String name)
      Verifie si le fichier est un fichier jar.
      Parameters:
      name - nom du fichier a tester
      Returns:
      vrai si le fichier se termine par .jar faux sinon
    • isZip

      public static boolean isZip(String name)
      Verifie si le fichier est un fichier zip
      Parameters:
      name - nom du fichier a tester
      Returns:
      vrai si le fichier se termine par .zip faux sinon
    • getURLsFromDirectory

      public static List<URL> getURLsFromDirectory(File repository, String pattern)
      Retourne la liste des fichiers correspondant au pattern donne, aucun ordre ne doit être supposé sur les fichiers.
      Parameters:
      repository - repertoire dans lequel on recherche les fichiers
      pattern - le nom du fichier a extraire du fichier du repertoire doit correspondre au pattern (repertoire + nom compris). si le pattern est null, tous les fichiers trouvé sont retourné.
      Returns:
      la liste des urls correspondant au pattern
    • getDeepURLs

      public static URL[] getDeepURLs(URLClassLoader loader)
      Returns the all urls to be used in a URLClassLoader. If classloader has only one url and the url is a jar, try to load in manifest class-path.
      Parameters:
      loader - the classloader (if null will use system one)
      Returns:
      all the url found in the classloader
    • getURLs

      public static URL[] getURLs(URLClassLoader classLoader)
      Recupere la liste des urls d'un URLClassLoader. Note : Un cas particulier est positionné pour JBoss qui utilise la method getAllURLs.
      Parameters:
      classLoader - le class loader a scanner
      Returns:
      les urls du classloade.
    • getClassPathURLsFromJarManifest

      public static URL[] getClassPathURLsFromJarManifest(URL jarURL) throws IOException, URISyntaxException
      Throws:
      IOException
      URISyntaxException