public void run() {
    try {
      if (discard) {
        while (is.read() != -1) {}
      } else {
        streamToBuffer(is, out);
      }
    } catch (IOException ioe) {

      throw new RuntimeException(ioe);

    } finally {
      InputOutputUtils.closeQuietly(is);
    }
  }
 /**
  * Attempts to read a list of strings from the resource, which is first checked as a file and then
  * as a classpath resource
  *
  * @param resource filename or classpath resource
  * @return list of strings read from resource
  */
 public static List<String> resourceToList(String resource) {
   List<String> l = CollectionUtils.createArrayList();
   try {
     File res = new File(resource);
     if (!res.exists()) {
       res = null;
       if (resourceExists(resource)) {
         res = File.createTempFile("resource", ".tmp");
         InputOutputUtils.copyFromClasspathToFileSystem(resource, res);
       }
     }
     if (res != null) l.addAll(org.apache.commons.io.FileUtils.readLines(res, null));
   } catch (IOException e) {
     throw new UtilUncheckedException("Could not read from resource " + resource, e);
   }
   return l;
 }