Exemple #1
0
  private void fetchOne(boolean examine, boolean save, YouAreEll yrl, InputStream is) {
    logger.entering(examine);
    logger.entering(save);
    logger.entering(yrl);

    if (examine) is = new DelimitedBufferedInputStream(is, '<', '>');

    BufferedOutputStream bos = null;
    WebFile wf = null;
    if (save) {
      wf = new WebFile(yrl, args);
      bos = wf.getBOS();

      if (bos == null) save = false;
    }

    if (save || examine) {
      if (!examineORsave(yrl, is, bos, examine, save, yrl.getURL())) {
        logger.severe("examineORsave failed");
      }
    }

    if (bos != null) {
      try {
        bos.close();
        if (args.SetLastModified) wf.getFile().setLastModified(yrl.getLastModified());
      } catch (IOException e) {
        logger.throwing(e);
      }
    }

    if (examine) {
      try {
        is.close();
      } catch (IOException e) {
        logger.throwing(e);
      }
    }
  }