org.pf.settings.rw
Class ManifestReaderWriter

java.lang.Object
  extended by org.pf.settings.rw.AbstractSettingsReaderWriter
      extended by org.pf.settings.rw.AbstractSettingsFileReaderWriter
          extended by org.pf.settings.rw.ManifestReaderWriter
All Implemented Interfaces:
SettingsFileReader, SettingsReader, SettingsWriter

public class ManifestReaderWriter
extends AbstractSettingsFileReaderWriter

Implements functionality to read manifest files into a settings object and write a settings object to a manifest file.

Version:
1.4
Author:
Manfred Duchrow

Constructor Summary
ManifestReaderWriter()
          Initialize the new instance with defaults.
ManifestReaderWriter(FileLocator locator)
          Initialize the new instance with the given file locator.
ManifestReaderWriter(java.lang.String aFilename)
          Initialize the new instance with the given filename.
 
Method Summary
static Settings loadSettings(java.lang.String filename, java.lang.Class settingsClass)
          Loads the manifest data from the specified file and returns it as settings.
static Settings manifestToSettings(java.util.jar.Manifest manifest, java.lang.Class settingsClass)
          Converts the given properties object to a settings object and returns it.
 java.util.jar.Manifest readManifestFrom(java.io.InputStream stream)
          Reads in manifest data from the specified stream.
static java.util.jar.Manifest readManifestFrom(java.lang.String filename)
          Reads in a manifest file from the file with the specified name.
 boolean storeSettings(Settings settings)
          Stores the given settings to the file with this object's filename in the format of Java manifest files.
 
Methods inherited from class org.pf.settings.rw.AbstractSettingsFileReaderWriter
getEncoding, getFileName, loadSettings, loadSettingsFrom, loadSettingsFrom, setEncoding, setFileName
 
Methods inherited from class org.pf.settings.rw.AbstractSettingsReaderWriter
loadSettings
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pf.settings.SettingsReader
loadSettings
 

Constructor Detail

ManifestReaderWriter

public ManifestReaderWriter()
Initialize the new instance with defaults.


ManifestReaderWriter

public ManifestReaderWriter(java.lang.String aFilename)
Initialize the new instance with the given filename.


ManifestReaderWriter

public ManifestReaderWriter(FileLocator locator)
Initialize the new instance with the given file locator.

Method Detail

manifestToSettings

public static Settings manifestToSettings(java.util.jar.Manifest manifest,
                                          java.lang.Class settingsClass)
Converts the given properties object to a settings object and returns it.


loadSettings

public static Settings loadSettings(java.lang.String filename,
                                    java.lang.Class settingsClass)
Loads the manifest data from the specified file and returns it as settings. The file will be automatically searched for in the whole classpath.

Parameters:
filename - The name of the manifest file.

readManifestFrom

public static java.util.jar.Manifest readManifestFrom(java.lang.String filename)
Reads in a manifest file from the file with the specified name. Returns the manifest object or null in any case of error. The file will be automatically searched for in the whole classpath.

Parameters:
filename - The name of the file to read

storeSettings

public boolean storeSettings(Settings settings)
Stores the given settings to the file with this object's filename in the format of Java manifest files.

NOT YET IMPLEMENTED

Parameters:
settings - The settings to store
Returns:
true, if the settings have been successfully stored. Otherwise false.

readManifestFrom

public java.util.jar.Manifest readManifestFrom(java.io.InputStream stream)
Reads in manifest data from the specified stream. Returns the manifest object or null in any case of error. The stream will be closed after calling this method!

Parameters:
stream - The stream to read the manifest data from