Example usage for com.google.gwt.util.tools.shared StringUtils toHexString

List of usage examples for com.google.gwt.util.tools.shared StringUtils toHexString

Introduction

In this page you can find the example usage for com.google.gwt.util.tools.shared StringUtils toHexString.

Prototype

public static String toHexString(byte[] bytes) 

Source Link

Document

Returns a string representation of the byte array as a series of hexadecimal characters.

Usage

From source file:cc.alcina.framework.gwt.appcache.linker.AppCacheManifestLinker.java

License:Apache License

private EmittedArtifact emitManifest(TreeLogger logger, LinkerContext context, EmittedArtifact userManifest,
        SortedSet<EmittedArtifact> artifacts) throws UnableToCompleteException {
    logger = logger.branch(TreeLogger.DEBUG, "Creating manifest artifact", null);
    // Try getting a user-defined manifest
    StringBuffer out = readManifestTemplate(logger, userManifest);
    // Use the template in the MD5 computation
    digester.update(Util.getBytes(out.toString()));
    // Look for @filter expressions in the manifest template
    Set<Pattern> filters = extractFilters(logger, out);
    // Append the builtin filters
    for (String pattern : BUILTIN_FILTERS) {
        filters.add(Pattern.compile(pattern));
    }/*from   w ww. ja va  2 s  . c om*/
    filters.add(Pattern.compile(".*?(^|/)\\.[^/]+"));// ignore .-prefixed
    // files (e.g.
    // .cvsignore)
    // Generate the manifest entries
    String entries = generateEntries(logger, context, filters, artifacts);
    replaceAll(out, "__VERSION__", StringUtils.toHexString(digester.digest()));
    replaceAll(out, "__ENTRIES__", entries.toString());
    /*
     * NB: It's tempting to use LinkerContext.optimizeJavaScript here, but
     * the JSON standard requires that the keys in the object literal will
     * be enclosed in double-quotes. In our optimized JS form, the
     * double-quotes would normally be removed.
     */
    return emitBytes(logger, Util.getBytes(out.toString()), "appcache.nocache.manifest");
}