code: private static void dumpTree(PrintWriter pw, DirectoryEntry dir, String prefix, boolean showData, boolean hex, String indent) throws Exception
     {
        long byteCount;
  
        for (Iterator<Entry> iter = dir.getEntries(); iter.hasNext();)
        {
           Entry entry = iter.next();
           if (entry instanceof DirectoryEntry)
           {
              String childIndent = indent;
              if (childIndent != null)
              {
                 childIndent += " ";
              }
  
              String childPrefix = prefix + "[" + entry.getName() + "].";
              pw.println("start dir: " + prefix + entry.getName());
              dumpTree(pw, (DirectoryEntry) entry, childPrefix, showData, hex, childIndent);
              pw.println("end dir: " + prefix + entry.getName());
           }
           else
              if (entry instanceof DocumentEntry)
              {
                 if (showData)
                 {
                    pw.println("start doc: " + prefix + entry.getName());
                    if (hex == true)
                    {
                       byteCount = hexdump(new DocumentInputStream((DocumentEntry) entry), pw);
                    }
                    else
                    {
                       byteCount = asciidump(new DocumentInputStream((DocumentEntry) entry), pw);
                    }
                    pw.println("end doc: " + prefix + entry.getName() + " (" + byteCount + " bytes read)");
                 }
                 else
                 {
                    if (indent != null)
                    {
                       pw.print(indent);
                    }
                    pw.println("doc: " + prefix + entry.getName());
                 }
              }
              else
              {
                 pw.println("found unknown: " + prefix + entry.getName());
              }
        }
     }
docs: This method recursively descends the directory structure, dumping
  details of any files it finds to the output file.
  
  @param pw Output PrintWriter
  @param dir DirectoryEntry to dump
  @param prefix prefix used to identify path to this object
  @param showData flag indicating if data is dumped, or just structure
  @param hex set to true if hex output is required
  @param indent indent used if displaying structure only
  @throws Exception Thrown on file read errors