/** * Generates a string containing the name, isDirectory setting and size of an entry. * <p> * For example:<br/> * <tt>- 2000 main.c</tt><br/> * <tt>d 100 testfiles</tt><br/> * * @return the representation of the entry */ public static String toString(ArchiveEntry entry) { StringBuilder sb = new StringBuilder(); sb.Append(entry.isDirectory()? 'd' : '-');// c.f. "ls -l" output String size = entry.getSize().toString(); sb.Append(' '); // Pad output to 7 places, leading spaces for (int i = 7; i > size.length(); i--) { sb.Append(' '); } sb.Append(size); sb.Append(' ').Append(entry.getName()); return(sb.toString()); }