org.codehaus.mojo.appassembler.util
Class FormattedProperties

java.lang.Object
  extended by org.codehaus.mojo.appassembler.util.FormattedProperties

public class FormattedProperties
extends java.lang.Object

A class to read/write a properties file, and retain the formatting through modifications.


Constructor Summary
FormattedProperties()
           
 
Method Summary
 java.lang.String getProperty(java.lang.String key)
           
 java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
           
 void read(java.io.InputStream inputStream)
          Read in the properties from the given stream.
 void removeProperty(java.lang.String key)
           
 void save(java.io.OutputStream outputStream)
           
 void setProperty(java.lang.String key, java.lang.String value)
           
 void setPropertyAfter(java.lang.String key, java.lang.String value, java.lang.String afterProperty)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormattedProperties

public FormattedProperties()
Method Detail

setProperty

public void setProperty(java.lang.String key,
                        java.lang.String value)

getProperty

public java.lang.String getProperty(java.lang.String key)

getProperty

public java.lang.String getProperty(java.lang.String key,
                                    java.lang.String defaultValue)

removeProperty

public void removeProperty(java.lang.String key)

read

public void read(java.io.InputStream inputStream)
          throws java.io.IOException
Read in the properties from the given stream. Note that this will be used as the basis of the next formatted write, even though properties from any previous read are still retained. This allows adding properties to the top of the file.

Parameters:
inputStream - the stream to read from
Throws:
java.io.IOException - if there is a problem reading the stream

save

public void save(java.io.OutputStream outputStream)

setPropertyAfter

public void setPropertyAfter(java.lang.String key,
                             java.lang.String value,
                             java.lang.String afterProperty)


Copyright © 2006-2009. All Rights Reserved.