code: static <T> T doWithMainClasses(JarFile jarFile, String classesLocation,
                                     ClassNameCallback<T> callback) throws IOException {
          List<JarEntry> classEntries = getClassEntries(jarFile, classesLocation);
          Collections.sort(classEntries, new ClassEntryComparator());
          for (JarEntry entry : classEntries) {
              InputStream inputStream = new BufferedInputStream(
                      jarFile.getInputStream(entry));
              try {
                  if (isMainClass(inputStream)) {
                      String className = convertToClassName(entry.getName(),
                              classesLocation);
                      T result = callback.doWith(className);
                      if (result != null) {
                          return result;
                      }
                  }
              } finally {
                  inputStream.close();
              }
          }
          return null;
      }
docs: Perform the given callback operation on all main classes from the given jar.
  
  @param <T>             the result type
  @param jarFile         the jar file to search
  @param classesLocation the location within the jar containing classes
  @param callback        the callback
  @return the first callback result or {@code null}
  @throws IOException in case of I/O errors