private static void copyToZipStream(File file, ZipEntry entry, ZipOutputStream zos)
    throws IOException {
    InputStream is = new FileInputStream(file);
    try {
      zos.putNextEntry(entry);
      byte[] arr = new byte[4096];
      int read = is.read(arr);
      while (read > -1) {
        zos.write(arr, 0, read);
        read = is.read(arr);
      }
    } finally {
      try {
        is.close();
      } finally {
        zos.closeEntry();
      }
    }
  }
Finds the Jar for a class. If the class is in a directory in the classpath, it creates a Jar on
the fly with the contents of the directory and returns the path to that Jar. If a Jar is created,
it is created in the system temporary directory. This file was forked from
hadoop/common/branches/branch-2@1377176.
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/JarFinder.java