예제 #1
0
 /**
  * Helper method to convert properties to string.
  *
  * @param prop a <code>Properties</code> value
  * @return a <code>String</code> value
  */
 public static String convertPropsToString(Properties prop) {
   if (prop == null) {
     return "{null}";
   }
   StringBuffer strBuf = new StringBuffer("{ ");
   for (Enumeration enum1 = prop.propertyNames(); enum1.hasMoreElements(); ) {
     Object obj = enum1.nextElement();
     strBuf.append("[ ").append(obj).append("->");
     Object val = prop.getProperty((String) obj);
     if (val == null) strBuf.append("null");
     else strBuf.append((String) val);
     strBuf.append(" ] ");
   }
   strBuf.append("}");
   return strBuf.toString();
 }
예제 #2
0
 /**
  * Converts an array of xids to string that can be printed. Its a helper method.
  *
  * @param xidArray a <code>Xid[]</code> value
  * @return a <code>String</code> value
  */
 public static String convertXidArrayToString(Xid[] xidArray) {
   if (xidArray.length != 0) {
     int i;
     StringBuffer strBuf =
         new StringBuffer(
             "Xid class name is "
                 + xidArray[0].getClass().getName()
                 + " Number of Xids are "
                 + xidArray.length
                 + " [ ");
     for (i = 0; i < xidArray.length - 1; i++) {
       strBuf.append(xidArray[i]).append("\n");
     }
     strBuf.append(xidArray[xidArray.length - 1]).append(" ]");
     return strBuf.toString();
   } else return " null ";
 }
예제 #3
0
 /**
  * Helper method to convert a byte arror to string. This is typically used for printing Xids.
  *
  * @param byteArray a <code>byte[]</code> value
  * @return a <code>String</code> value
  */
 public static String convertToString(byte[] byteArray) {
   int i;
   StringBuffer strBuf = new StringBuffer();
   for (i = 0; i < byteArray.length; i++) {
     strBuf.append(byteArray[i]);
   }
   return strBuf.toString();
 }