Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.common.util.ReadWrite Class Reference

List of all members.

Static Public Member Functions

String write (Hashtable table, boolean prefix)
String write (ArrayList list, String listName, boolean writeCountKey)

Detailed Description

This class defines reading and writing convenient methods

Author:
Nicolas Modrzyk
Version:
1.0

Definition at line 37 of file ReadWrite.java.


Member Function Documentation

String org.objectweb.cjdbc.common.util.ReadWrite.write ArrayList  list,
String  listName,
boolean  writeCountKey
[static]
 

Write the content of the ArrayList in a readable format

Parameters:
list the list to get the values from
listName give the prefix names for values
writeCountKey should we write the count keys
Returns:
String conversion for the list content

Definition at line 95 of file ReadWrite.java.

00097   {
00098     if (list == null)
00099       return "";
00100     StringBuffer buffer = new StringBuffer();
00101     int size = list.size();
00102     if (writeCountKey)
00103       buffer.append(listName + ".items.count=" + size
00104           + System.getProperty("line.separator"));
00105     for (int i = 0; i < size; i++)
00106       buffer.append(listName + "." + i + "=" + list.get(i)
00107           + System.getProperty("line.separator"));
00108     return buffer.toString();
00109   }

String org.objectweb.cjdbc.common.util.ReadWrite.write Hashtable  table,
boolean  prefix
[static]
 

Write the content of the Hashtable in a readable format

Parameters:
table the hashtable to get keys and values from
prefix prefix some values with tabs
Returns:
String conversion for the table content

Definition at line 47 of file ReadWrite.java.

00048   {
00049     if (table == null)
00050       return "";
00051     StringBuffer buffer = new StringBuffer();
00052     Enumeration e = table.keys();
00053     Object o;
00054     while (e.hasMoreElements())
00055     {
00056       o = e.nextElement();
00057       if (o.toString().indexOf(".path") != -1)
00058       {
00059         // This is a class path, make it look nice
00060         buffer.append(o + " = " + System.getProperty("line.separator"));
00061         String substring = (String) table.get(o);
00062         int index;
00063         while (true)
00064         {
00065           index = substring.indexOf(':');
00066           if (index == -1)
00067             break;
00068           if (prefix)
00069             buffer.append("\t\t");
00070           buffer.append(substring.substring(0, index)
00071               + System.getProperty("line.separator"));
00072           substring = substring.substring(index + 1);
00073         }
00074         if (prefix)
00075           buffer.append("\t\t");
00076         buffer.append(substring + System.getProperty("line.separator"));
00077       }
00078       else
00079       {
00080         buffer.append(o + " = " + table.get(o)
00081             + System.getProperty("line.separator"));
00082       }
00083     }
00084     return buffer.toString();
00085   }


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:02:14 2005 for C-JDBC by  doxygen 1.3.9.1