private static String readFileAsString(String filePath) throws IOException {
   StringBuffer fileData = new StringBuffer();
   BufferedReader reader = new BufferedReader(new FileReader(filePath));
   char[] buf = new char[1024];
   int numRead = 0;
   while ((numRead = reader.read(buf)) != -1) {
     String readData = String.valueOf(buf, 0, numRead);
     fileData.append(readData);
   }
   reader.close();
   return fileData.toString();
 }
Exemple #2
0
    public Element reportDtElem() {
      StringBuffer sb = new StringBuffer(255);
      sb.append(shortTypeName);
      sb.append(" [ dataSourceName: ");
      sb.append(pds.getDataSourceName());
      sb.append("; identityToken: ");
      sb.append(pds.getIdentityToken());
      sb.append(" ]");

      Element dtElem = doc.createElement("dt");
      dtElem.appendChild(doc.createTextNode(sb.toString()));
      return dtElem;
    }