java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.FileDumpHelper

public class FileDumpHelperextends HelperBase
Dump info on jars and wars.
  • Field Details

    • DUMP_DASH

      private static final Pattern DUMP_DASH
      Matches the revision dash in a dump line.
  • Constructor Details

    • FileDumpHelper

      public FileDumpHelper()
      Constructor. The console builds this helper per page render and the jar scanning below reads its arguments from the request, so a bare instance is all that is needed.
  • Method Details

    • getFileSummary

      public String getFileSummary()
      Build the HTML table summarising the jars in this distribution.
      Returns:
      the file summary
    • dumpDir

      private static void dumpDir(StringBuilder buf, File dir, String suffix, boolean linkrev)
      Lists the files of a directory into the dump.
      Parameters:
      buf - where the listing is written
      dir - the directory to list
      suffix - only files ending like this are listed
      linkrev - true to link each file to its source
    • dumpFile

      private static void dumpFile(StringBuilder buf, File f, boolean linkrev)
      Writes one file's size, date and hash into the dump.
      Parameters:
      buf - where the entry is written
      f - the file to describe
      linkrev - true to link the file to its source
    • sha256

      private static byte[] sha256(File f)
      Hashes a file for the dump.
      Parameters:
      f - the file to hash
      Returns:
      the hash, null if the file cannot be read
    • attributes

      static Attributes attributes(File f)
      Read the manifest attributes from the given jar file.
      Parameters:
      f - the jar whose META-INF/MANIFEST.MF main attributes to read
      Returns:
      null if not found
    • getAtt

      static String getAtt(Attributes atts, String s)
      Get a manifest attribute value with HTML stripped.
      Parameters:
      atts - non-null
      s - the attribute name
      Returns:
      HTML stripped, or null if not found