QJCC homepage

biz.chitec.quarterback.util
Class OrderedPropertyStorer

java.lang.Object
  extended bybiz.chitec.quarterback.util.OrderedPropertyStorer

public final class OrderedPropertyStorer
extends java.lang.Object

Helper class to store contents of a properties list in alphabetical order. Needed for CVS controlled resources to let CVS having a chance of getting changes sorted out. For the same reason the class offers the possibility not to store the timestamp in the header of the properties file.

Inspired by some code of Properties.java as that one is somehow brain-dead when it comes to storing its contents ordered...

Version:
$Id: 354d74126a2deedd7ef3664ee55a1431ce72d617 $
Author:
chitec/Dirk Hillbrecht 2002. Distributed under the terms of the GNU LGPL.

Field Summary
private  boolean iscvs
           
private  boolean isunixlinefeed
           
private static OrderedPropertyStorer singleton
           
 
Constructor Summary
OrderedPropertyStorer(boolean iscvsx, boolean isunixlinefeedx)
          This class is non-instanciable.
 
Method Summary
 boolean isCVS()
           
 boolean isDefaultCVS()
           
 boolean isDefaultUnixLineFeed()
           
 boolean isUnixLineFeed()
           
private  java.lang.String saveConvert(java.lang.String theString, boolean escapeSpace)
          Converts unicodes to encoded \uxxxx and writes out any special characters with a preceding slash.
 void setCVS(boolean iscvs)
           
 void setDefaultCVS(boolean iscvs)
           
 void setDefaultUnixLineFeed(boolean b)
           
 void setUnixLineFeed(boolean b)
           
 void store(java.util.Properties props, java.io.OutputStream out, java.lang.String header)
          Writes a Properties' list ordered into the given stream.
static void storeDefault(java.util.Properties props, java.io.OutputStream out, java.lang.String header)
          Writes a Properties' list ordered into the given stream.
private  char toHex(int nibble)
          Convert a nibble to a hex character
private  void writeln(java.io.BufferedWriter bw, java.lang.String s)
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

private static OrderedPropertyStorer singleton

iscvs

private boolean iscvs

isunixlinefeed

private boolean isunixlinefeed
Constructor Detail

OrderedPropertyStorer

public OrderedPropertyStorer(boolean iscvsx,
                             boolean isunixlinefeedx)
This class is non-instanciable.

Method Detail

setCVS

public void setCVS(boolean iscvs)

isCVS

public boolean isCVS()

setUnixLineFeed

public void setUnixLineFeed(boolean b)

isUnixLineFeed

public boolean isUnixLineFeed()

setDefaultCVS

public void setDefaultCVS(boolean iscvs)

isDefaultCVS

public boolean isDefaultCVS()

setDefaultUnixLineFeed

public void setDefaultUnixLineFeed(boolean b)

isDefaultUnixLineFeed

public boolean isDefaultUnixLineFeed()

toHex

private char toHex(int nibble)
Convert a nibble to a hex character

Parameters:
nibble - the nibble to convert.
Returns:
Description of the Return Value

saveConvert

private java.lang.String saveConvert(java.lang.String theString,
                                     boolean escapeSpace)
Converts unicodes to encoded \uxxxx and writes out any special characters with a preceding slash.

Parameters:
theString - Description of the Parameter
escapeSpace - Description of the Parameter
Returns:
Description of the Return Value

store

public void store(java.util.Properties props,
                  java.io.OutputStream out,
                  java.lang.String header)
           throws java.io.IOException
Writes a Properties' list ordered into the given stream.

Parameters:
out - an output stream.
header - a description of the property list.
props - Description of the Parameter
Throws:
java.io.IOException - if writing this property list to the specified output stream throws an IOException .

writeln

private void writeln(java.io.BufferedWriter bw,
                     java.lang.String s)
              throws java.io.IOException
Description of the Method

Parameters:
bw - Description of the Parameter
s - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

storeDefault

public static void storeDefault(java.util.Properties props,
                                java.io.OutputStream out,
                                java.lang.String header)
                         throws java.io.IOException
Writes a Properties' list ordered into the given stream.

Parameters:
out - an output stream.
header - a description of the property list.
props - Description of the Parameter
Throws:
java.io.IOException - if writing this property list to the specified output stream throws an IOException .

QJCC homepage