List of utility methods to do Jar Usage
Pack200.Packer | _getPacker() get Packer Pack200.Packer packer = Pack200.newPacker(); Map<String, String> p = packer.properties(); p.put(Pack200.Packer.EFFORT, "7"); p.put(Pack200.Packer.SEGMENT_LIMIT, "-1"); p.put(Pack200.Packer.KEEP_FILE_ORDER, Pack200.Packer.FALSE); p.put(Pack200.Packer.MODIFICATION_TIME, Pack200.Packer.LATEST); p.put(Pack200.Packer.DEFLATE_HINT, Pack200.Packer.FALSE); p.put(Pack200.Packer.UNKNOWN_ATTRIBUTE, Pack200.Packer.ERROR); ... |
Dictionary | allocateReadOnlyDictionary(final Attributes attributes) allocate Read Only Dictionary return new Dictionary() { public int size() { return attributes.size(); public boolean isEmpty() { return attributes.isEmpty(); public Enumeration keys() { ... |
Dictionary | allocateReadOnlyI18nDictionary(final Attributes attributes, final ResourceBundle resourceBundle) allocate Read Only In Dictionary return new Dictionary() { public int size() { return attributes.size(); public boolean isEmpty() { return attributes.isEmpty(); public Enumeration keys() { ... |
boolean | checkJarValidity(String path) Checks that file is valid jar archive try { JarFile jar = new JarFile(path); jar.size(); } catch (Exception e) { return false; return true; |
boolean | containsClass(JarFile jarFile, String agentRunnerClassName) contains Class Enumeration<JarEntry> e = jarFile.entries(); while (e.hasMoreElements()) { JarEntry je = e.nextElement(); if (je.isDirectory() || !je.getName().endsWith(".class")) { continue; String className = je.getName().substring(0, je.getName().length() - 6); className = className.replace('/', '.'); ... |
boolean | containsClass(JarFile jarFile, String classFilePath) contains Class final Enumeration<JarEntry> entries = jarFile.entries(); while (entries.hasMoreElements()) { final JarEntry entry = entries.nextElement(); if ((!entry.isDirectory()) && entry.getName().contains(classFilePath)) { return true; return false; ... |
Map | convertAttributes(Attributes attributes) convert Attributes Map result = new HashMap(); for (Iterator iter = attributes.keySet().iterator(); iter.hasNext();) { Attributes.Name key = (Name) iter.next(); result.put(key.toString(), attributes.getValue(key)); return result; |
Packer | createPacker() create Packer Pack200.Packer p = Pack200.newPacker(); SortedMap<String, String> props = p.properties(); props.put(Pack200.Packer.MODIFICATION_TIME, Pack200.Packer.KEEP); props.put(Pack200.Packer.EFFORT, "0"); return p; |
void | findClassesByJar(String packageName, JarFile jar, final boolean recursive, Set find Classes By Jar String packageDirName = packageName.replace('.', '/'); Enumeration<JarEntry> jarEntries = jar.entries(); JarEntry jarEntry; String name, className; Class<?> claze; while (jarEntries.hasMoreElements()) { jarEntry = jarEntries.nextElement(); name = jarEntry.getName(); ... |
Attributes | getAttribute(String name, String value) get Attribute Attributes a = new Attributes(); Attributes.Name attribName = new Attributes.Name(name); a.put(attribName, value); return a; |