274
275 /**
276 * Reads the index from the specified InputStream.
277 *
278 * @param is the input stream
279 * @exception IOException if an I/O error has occurred
280 */
281 public void read(InputStream is) throws IOException {
282 BufferedReader br = new BufferedReader
283 (new InputStreamReader(is, "UTF8"));
284 String line = null;
285 String currentJar = null;
286
287 /* an ordered list of jar file names */
288 Vector<String> jars = new Vector<>();
289
290 /* read until we see a .jar line */
291 while((line = br.readLine()) != null && !line.endsWith(".jar"));
292
293 for(;line != null; line = br.readLine()) {
294 if (line.length() == 0)
295 continue;
296
297 if (line.endsWith(".jar")) {
298 currentJar = line;
299 jars.add(currentJar);
300 } else {
301 String name = line;
302 addMapping(name, currentJar);
303 }
304 }
305
306 jarFiles = jars.toArray(new String[jars.size()]);
307 }
308
309 /**
310 * Merges the current index into another index, taking into account
311 * the relative path of the current index.
312 *
313 * @param toIndex The destination index which the current index will
314 * merge into.
|
274
275 /**
276 * Reads the index from the specified InputStream.
277 *
278 * @param is the input stream
279 * @exception IOException if an I/O error has occurred
280 */
281 public void read(InputStream is) throws IOException {
282 BufferedReader br = new BufferedReader
283 (new InputStreamReader(is, "UTF8"));
284 String line = null;
285 String currentJar = null;
286
287 /* an ordered list of jar file names */
288 Vector<String> jars = new Vector<>();
289
290 /* read until we see a .jar line */
291 while((line = br.readLine()) != null && !line.endsWith(".jar"));
292
293 for(;line != null; line = br.readLine()) {
294 if (line.isEmpty())
295 continue;
296
297 if (line.endsWith(".jar")) {
298 currentJar = line;
299 jars.add(currentJar);
300 } else {
301 String name = line;
302 addMapping(name, currentJar);
303 }
304 }
305
306 jarFiles = jars.toArray(new String[jars.size()]);
307 }
308
309 /**
310 * Merges the current index into another index, taking into account
311 * the relative path of the current index.
312 *
313 * @param toIndex The destination index which the current index will
314 * merge into.
|