Class Bundle


  • public class Bundle
    extends java.lang.Object
    Load string resources from file. Resources should be stored in name=value format.
    Author:
    Alexandre Iline (alexandre.iline@sun.com)
    See Also:
    BundleManager
    • Constructor Summary

      Constructors 
      Constructor Description
      Bundle()
      Bunble constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getResource​(java.lang.String key)
      Gets resource by key.
      void load​(java.io.InputStream stream)
      Loads resources from an input stream.
      void loadFromFile​(java.lang.String fileName)
      Loads resources from a simple file.
      void loadFromJar​(java.lang.String fileName, java.lang.String entryName)
      Loads resources from a file in a jar archive.
      void loadFromZip​(java.lang.String fileName, java.lang.String entryName)
      Loads resources from a file in a zip archive.
      void print​(java.io.PrintStream stream)
      Prints bundle contents.
      void print​(java.io.PrintWriter writer)
      Prints bundle contents.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Bundle

        public Bundle()
        Bunble constructor.
    • Method Detail

      • load

        public void load​(java.io.InputStream stream)
                  throws java.io.IOException
        Loads resources from an input stream.
        Parameters:
        stream - Stream to load resources from.
        Throws:
        java.io.IOException
      • loadFromFile

        public void loadFromFile​(java.lang.String fileName)
                          throws java.io.IOException,
                                 java.io.FileNotFoundException
        Loads resources from a simple file.
        Parameters:
        fileName - Name of the file to load resources from.
        Throws:
        java.io.IOException
        java.io.FileNotFoundException
      • loadFromJar

        public void loadFromJar​(java.lang.String fileName,
                                java.lang.String entryName)
                         throws java.io.IOException,
                                java.io.FileNotFoundException
        Loads resources from a file in a jar archive.
        Parameters:
        fileName - Name of the jar archive.
        entryName - ?enryName? Name of the file to load resources from.
        Throws:
        java.io.IOException
        java.io.FileNotFoundException
      • loadFromZip

        public void loadFromZip​(java.lang.String fileName,
                                java.lang.String entryName)
                         throws java.io.IOException,
                                java.io.FileNotFoundException,
                                java.util.zip.ZipException
        Loads resources from a file in a zip archive.
        Parameters:
        fileName - Name of the zip archive.
        entryName - ?enryName? Name of the file to load resources from.
        Throws:
        java.util.zip.ZipException
        java.io.IOException
        java.io.FileNotFoundException
      • print

        public void print​(java.io.PrintWriter writer)
        Prints bundle contents.
        Parameters:
        writer - Writer to print data in.
      • print

        public void print​(java.io.PrintStream stream)
        Prints bundle contents.
        Parameters:
        stream - Stream to print data in.
      • getResource

        public java.lang.String getResource​(java.lang.String key)
        Gets resource by key.
        Parameters:
        key - Resource key
        Returns:
        Resource value or null if resource was not found.