89 */ 90 public JarIndex(InputStream is) throws IOException { 91 this(); 92 read(is); 93 } 94 95 /** 96 * Constructs a new index for the specified list of jar files. 97 * 98 * @param files the list of jar files to construct the index from. 99 */ 100 public JarIndex(String[] files) throws IOException { 101 this(); 102 this.jarFiles = files; 103 parseJars(files); 104 } 105 106 /** 107 * Returns the jar index, or <code>null</code> if none. 108 * 109 * This single parameter version of the method is retained 110 * for binary compatibility with earlier releases. 111 * 112 * @param jar the JAR file to get the index from. 113 * @exception IOException if an I/O error has occurred. 114 */ 115 public static JarIndex getJarIndex(JarFile jar) throws IOException { 116 return getJarIndex(jar, null); 117 } 118 119 /** 120 * Returns the jar index, or <code>null</code> if none. 121 * 122 * @param jar the JAR file to get the index from. 123 * @exception IOException if an I/O error has occurred. 124 */ 125 public static JarIndex getJarIndex(JarFile jar, MetaIndex metaIndex) throws IOException { 126 JarIndex index = null; 127 /* If metaIndex is not null, check the meta index to see 128 if META-INF/INDEX.LIST is contained in jar file or not. 129 */ 130 if (metaIndex != null && 131 !metaIndex.mayContain(INDEX_NAME)) { 132 return null; 133 } 134 JarEntry e = jar.getJarEntry(INDEX_NAME); 135 // if found, then load the index 136 if (e != null) { 137 index = new JarIndex(jar.getInputStream(e)); 138 } 139 return index; 140 } 141 142 /** 143 * Returns the jar files that are defined in this index. 144 */ 145 public String[] getJarFiles() { 146 return jarFiles; 147 } 148 149 /* 150 * Add the key, value pair to the hashmap, the value will 151 * be put in a linked list which is created if necessary. 152 */ 153 private void addToList(String key, String value, | 89 */ 90 public JarIndex(InputStream is) throws IOException { 91 this(); 92 read(is); 93 } 94 95 /** 96 * Constructs a new index for the specified list of jar files. 97 * 98 * @param files the list of jar files to construct the index from. 99 */ 100 public JarIndex(String[] files) throws IOException { 101 this(); 102 this.jarFiles = files; 103 parseJars(files); 104 } 105 106 /** 107 * Returns the jar index, or <code>null</code> if none. 108 * 109 * @param jar the JAR file to get the index from. 110 * @exception IOException if an I/O error has occurred. 111 */ 112 public static JarIndex getJarIndex(JarFile jar) throws IOException { 113 JarIndex index = null; 114 JarEntry e = jar.getJarEntry(INDEX_NAME); 115 // if found, then load the index 116 if (e != null) { 117 index = new JarIndex(jar.getInputStream(e)); 118 } 119 return index; 120 } 121 122 /** 123 * Returns the jar files that are defined in this index. 124 */ 125 public String[] getJarFiles() { 126 return jarFiles; 127 } 128 129 /* 130 * Add the key, value pair to the hashmap, the value will 131 * be put in a linked list which is created if necessary. 132 */ 133 private void addToList(String key, String value, |