package ch.deletescape.jterm;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class Util {
  public static String makePathString(String cmd) {
    return cmd.replace("~", JTerm.getHome());
  }

  public static String copyStream(InputStream input, OutputStream output) throws IOException {
    StringBuilder sb = new StringBuilder();
    byte[] buffer = new byte[1024];
    int bytesRead;
    while ((bytesRead = input.read(buffer)) != -1) {
      output.write(buffer, 0, bytesRead);
      sb.append(new String(buffer, 0, bytesRead));
    }
    return sb.toString();
  }
}

@@ -136,108 +136,536 @@
 %7B%0A  
-public static String makePathString(String cmd) %7B%0A    return cmd.replace(%22~%22, JTerm.getHome());%0A  %7D%0A
+/**%0A   * Replaces the tilde (~) with the home directory in a string%0A   * %0A   * @param cmd%0A   *          The path to parse%0A   * @return The new String%0A   */%0A  public static String makePathString(String cmd) %7B%0A    return cmd.replace(%22~%22, JTerm.getHome());%0A  %7D%0A%0A  /**%0A   * Writes the content of input into output%0A   * %0A   * @param input%0A   *          The %7B@link InputStream%7D to be copied to%0A   * @param output%0A   *          The target %7B@link OutputStream%7D to copy to%0A   * @return The content of input%0A   * @throws IOException%0A   */
 %0A  p

add javadoc to Util