com.japisoft.framework.app.toolkit
Class Toolkit

java.lang.Object
  extended bycom.japisoft.framework.app.toolkit.Toolkit

public class Toolkit
extends java.lang.Object

Various facilities like : Managing icons, file encoding, template

Version:
1.0
Author:
(c) 2004 JAPISoft / http://www.japisoft.com

Nested Class Summary
static class Toolkit.EmptyIcon
          Empty icon for alignment on popup
 
Field Summary
static java.lang.String[] FILE_ENCODING
           
 
Constructor Summary
Toolkit()
           
 
Method Summary
static java.lang.String getContentFromFileName(java.lang.String fileName)
           
static java.lang.String getContentFromInputStream(java.io.InputStream input)
          It uses the default file encoding from the preference file/rw-encoding
static java.lang.String getContentFromInputStream(java.io.InputStream input, java.lang.String encoding)
           
static java.lang.String getCurrentFileEncoding()
          It uses the preference file/rw-encoding
static javax.swing.Icon getDefaultImage()
           
static java.lang.String getEncodedString(byte[] data)
           
static javax.swing.Icon getImageIcon(java.lang.String location)
           
static javax.swing.Icon getImageIcon(java.lang.String location, boolean defaultEmptyImage)
           
static java.lang.String getPathForObject(java.lang.String resource)
          Retreive an initial resource location using this resource name
static java.io.Reader getReaderForFile(java.io.File fileName)
           
static java.io.Reader getReaderForFile(java.io.File fileName, java.lang.String encoding)
           
static java.io.Reader getReaderForFile(java.lang.String fileName)
           
static java.io.Writer getWriterForFile(java.io.File fileName)
           
static java.io.Writer getWriterForFile(java.io.File fileName, java.lang.String encoding)
           
static boolean removeDirectoryAndContent(java.io.File dir)
           
static java.lang.String resolve(java.util.Hashtable ht, java.lang.String template)
           
static java.lang.String toURL(java.io.File f)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_ENCODING

public static java.lang.String[] FILE_ENCODING
Constructor Detail

Toolkit

public Toolkit()
Method Detail

getImageIcon

public static javax.swing.Icon getImageIcon(java.lang.String location)

getImageIcon

public static javax.swing.Icon getImageIcon(java.lang.String location,
                                            boolean defaultEmptyImage)

getCurrentFileEncoding

public static java.lang.String getCurrentFileEncoding()
It uses the preference file/rw-encoding


getReaderForFile

public static java.io.Reader getReaderForFile(java.io.File fileName)
                                       throws java.io.IOException
Throws:
java.io.IOException

getReaderForFile

public static java.io.Reader getReaderForFile(java.io.File fileName,
                                              java.lang.String encoding)
                                       throws java.io.IOException
Throws:
java.io.IOException

getReaderForFile

public static java.io.Reader getReaderForFile(java.lang.String fileName)
                                       throws java.io.IOException
Throws:
java.io.IOException

getWriterForFile

public static java.io.Writer getWriterForFile(java.io.File fileName,
                                              java.lang.String encoding)
                                       throws java.io.IOException
Throws:
java.io.IOException

getWriterForFile

public static java.io.Writer getWriterForFile(java.io.File fileName)
                                       throws java.io.IOException
Throws:
java.io.IOException

getEncodedString

public static java.lang.String getEncodedString(byte[] data)
                                         throws java.io.IOException
Throws:
java.io.IOException

getContentFromFileName

public static java.lang.String getContentFromFileName(java.lang.String fileName)
                                               throws java.lang.Throwable
Throws:
java.lang.Throwable

getContentFromInputStream

public static java.lang.String getContentFromInputStream(java.io.InputStream input)
                                                  throws java.lang.Throwable
It uses the default file encoding from the preference file/rw-encoding

Throws:
java.lang.Throwable

getContentFromInputStream

public static java.lang.String getContentFromInputStream(java.io.InputStream input,
                                                         java.lang.String encoding)
                                                  throws java.lang.Throwable
Throws:
java.lang.Throwable

getPathForObject

public static java.lang.String getPathForObject(java.lang.String resource)
Retreive an initial resource location using this resource name


toURL

public static java.lang.String toURL(java.io.File f)
                              throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

removeDirectoryAndContent

public static boolean removeDirectoryAndContent(java.io.File dir)

resolve

public static java.lang.String resolve(java.util.Hashtable ht,
                                       java.lang.String template)
                                throws java.lang.Exception
Throws:
java.lang.Exception

getDefaultImage

public static javax.swing.Icon getDefaultImage()