java.lang.Object
net.i2p.router.web.HelperBase
net.i2p.router.web.helpers.FileDumpHelper
Dump info on jars and wars.
Field Summary
FieldsFields inherited from class HelperBase
_context, _log, _out, CHECKED, PROP_ADVANCED, SELECTEDModifier and TypeFieldDescriptionprotected RouterContextThe router context.protected LogThe log instance.protected WriterThe writer for output.static final StringChecked attribute for HTML checkboxes.static final StringProperty key for advanced mode.static final StringSelected attribute for HTML select options.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescription(package private) static Attributesattributes(File f) Read the manifest attributes from the given jar file.private static voiddumpDir(StringBuilder buf, File dir, String suffix, boolean linkrev) Lists the files of a directory into the dump.private static voiddumpFile(StringBuilder buf, File f, boolean linkrev) Writes one file's size, date and hash into the dump.(package private) static StringgetAtt(Attributes atts, String s) Get a manifest attribute value with HTML stripped.Build the HTML table summarising the jars in this distribution.private static byte[]Hashes a file for the dump.Methods inherited from class HelperBase
_t, _t, _t, _x, getChecked, isAdvanced, ngettext, setContextId, storeWriterModifier and TypeMethodDescriptionTranslate a string.Translate a string with a parameter.Translate a string with two parameters.static StringMark a string for extraction by xgettext and translation.protected StringgetChecked(String prop) Get the checked attribute for a boolean property.booleanCheck if advanced mode is enabled.Translate a string with plural forms (ngettext).voidsetContextId(String contextId) Configure this bean to query a particular router context.voidstoreWriter(Writer out) Store the writer for output.
Field Details
DUMP_DASH
Matches the revision dash in a dump line.LINK
Base URL for linking a dumped file to our source tree.- See Also:
UPSTREAMLINK
Base URL for linking a dumped file to the upstream source tree.- See Also:
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
Build the HTML table summarising the jars in this distribution.- Returns:
- the file summary
dumpDir
Lists the files of a directory into the dump.- Parameters:
buf- where the listing is writtendir- the directory to listsuffix- only files ending like this are listedlinkrev- true to link each file to its source
dumpFile
Writes one file's size, date and hash into the dump.- Parameters:
buf- where the entry is writtenf- the file to describelinkrev- true to link the file to its source
sha256
Hashes a file for the dump.- Parameters:
f- the file to hash- Returns:
- the hash, null if the file cannot be read
attributes
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
Get a manifest attribute value with HTML stripped.- Parameters:
atts- non-nulls- the attribute name- Returns:
- HTML stripped, or null if not found