/** ** Reads/returns the specified CompileTime template file */
  private static String readTemplate(File tf, String pkgName) {

    /* read template data */
    byte templData[] = FileTools.readFile(tf);
    if (templData == null) {
      Print.errPrintln("\nUnable to read Input/Template file: " + tf);
      return null;
    } else if (templData.length == 0) {
      Print.errPrintln("\nInput/Template file is empty: " + tf);
      return null;
    }

    /* return template String */
    String templateText = StringTools.toStringValue(templData);
    if (!StringTools.isBlank(pkgName) && !StringTools.isBlank(templateText)) {
      String lines[] = StringTools.split(templateText, '\n', false);
      for (int i = 0; i < lines.length; i++) {
        if (lines[i].trim().startsWith(JAVA_PACKAGE_)) {
          lines[i] = CompiletimeVars.packageLine(pkgName);
          return StringTools.join(lines, '\n') + "\n";
        }
      }
      StringBuffer sb = new StringBuffer();
      sb.append(CompiletimeVars.packageLine(pkgName)).append("\n");
      sb.append(templateText);
      return sb.toString();
    } else {
      return templateText;
    }
  }
  /** ** Return the standard "CompileTime.java" template */
  private static String standardTemplate(String tn, String pkgName) {

    /* not a standard template specification? */
    if (!StringTools.isBlank(tn) && !tn.startsWith(TEMPLATE_)) {
      Print.errPrintln("\nNot a Standard Template specification: " + tn);
      return null;
    }

    /* set default standard template name */
    if (StringTools.isBlank(tn) || tn.equals(TEMPLATE_)) {
      tn = TEMPLATE_DEFAULT;
    }

    /* default/CompileTimestamp template */
    if (tn.equalsIgnoreCase(TEMPLATE_DEFAULT)) {
      StringBuffer sb = new StringBuffer();
      sb.append(CompiletimeVars.packageLine(pkgName)).append("\n");
      sb.append("public class CompileTime\n");
      sb.append("{\n");
      sb.append("    // %{datetime=0000/00/00 00:00:00 GMT}\n");
      sb.append(
          "    public static final String SERVICE_ACCOUNT_ID   = \"%{ServiceAccount.ID=}\";\n");
      sb.append(
          "    public static final String SERVICE_ACCOUNT_NAME = \"%{ServiceAccount.Name=}\";\n");
      sb.append(
          "    public static final String SERVICE_ACCOUNT_HASH = \"%{ServiceAccount.ID.md5}\";\n");
      sb.append(
          "    public static final String SERVICE_ACCOUNT_KEY  = \"%{ServiceAccount.Key=}\";\n");
      sb.append("    public static final long   COMPILE_TIMESTAMP    = %{timestamp=0}L;\n");
      sb.append(
          "    public static final String COMPILE_DATETIME     = \"%{date=0000/00/00} %{time=00:00:00} %{timezone=GMT}\";\n");
      sb.append("    public static final long   COMPILE_SEED         = %{random.64}L;\n");
      sb.append("}\n");
      return sb.toString();
    }

    /* standard template not found */
    Print.errPrintln("\nStandard Template name not found: " + tn);
    return null;
  }