class Directory implements Serializable {

  public void deleteContents() throws DirectoryException {
    // We rely on the order of the listContents result: more deeply
    // nested files are later in the list.
    final File[] deleteList = listContents(s_matchAllFilesFilter, true, true);

    for (int i = deleteList.length - 1; i >= 0; --i) {
      if (deleteList[i].equals(getFile())) {
        continue;
      }

      if (!deleteList[i].delete()) {
        throw new DirectoryException(
          "Could not delete '" + deleteList[i] + "'");
      }
    }
  }

  public  Directory();
  public  Directory(final File directory);

}