List of usage examples for com.google.gwt.util.tools.shared StringUtils toHexString
public static String toHexString(byte[] bytes)
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"); }