/*
   * Creates a file at filename if file doesn't exist. Writes
   * value to that file using FileChannel.
   */
  public static void writeToFile(File filename, String value, String hideCommand)
      throws IOException, InterruptedException {
    if (!hideCommand.trim().equals("")) {
      // unhideFile(filename);
    }

    if (!filename.exists()) {
      filename.createNewFile();
    }

    byte[] bytes = value.getBytes();
    ByteBuffer buffer = ByteBuffer.allocate(bytes.length);
    for (int i = 0; i < bytes.length; i++) {
      buffer.put(bytes[i]);
    }
    buffer.rewind();

    try {

      fileWriter = new FileOutputStream(filename).getChannel();
      fileWriter.write(buffer);
    } finally {
      fileWriter.close();
    }

    if (!hideCommand.trim().equals("")) {
      // hideFile(filename);
    }
  }
  /*
   * Creates a file and returns true if the file doesn't already exist.
   * Does nothing and returns false otherwise.
   */
  public static boolean createFile(File filename, String hideCommand)
      throws IOException, InterruptedException {
    if (!filename.exists()) {
      filename.createNewFile();

      if (!hideCommand.trim().equals("")) {
        // hideFile(filename);
      }
      return true;
    }

    return false;
  }