code: private static File extract(String name, InputStream is) throws IOException {
          byte[] buf = new byte[4096];
          int len;
  
          File lib = File.createTempFile(name, "lib");
          FileOutputStream os = new FileOutputStream(lib);
  
          try {
              while ((len = is.read(buf)) > 0) {
                  os.write(buf, 0, len);
              }
          } catch (IOException e) {
              lib.delete();
              throw e;
          } finally {
              os.close();
              is.close();
          }
  
          return lib;
      }
docs: Extract a jar entry to a temp file.
  
  @param name  Name prefix for temp file.
  @param is    Jar entry input stream.
  
  @return A temporary file.
  
  @throws IOException when an IO error occurs.