protected boolean isJar(URL url, byte[] buffer) {
    InputStream is = null;
    try {
      is = url.openStream();
      is.read(buffer, 0, JAR_MAGIC.length);
      if (Arrays.equals(buffer, JAR_MAGIC)) {
        log.debug("Found JAR: " + url);
        return true;
      }
    } catch (Exception e) {
      // Failure to read the stream means this is not a JAR
    } finally {
      if (is != null) {
        try {
          is.close();
        } catch (Exception e) {
          // Ignore
        }
      }
    }

    return false;
  }
Returns true if the resource located at the given URL is a JAR file.

@param url The URL of the resource to test.
@param buffer A buffer into which the first few bytes of the resource are read. The buffer
           must be at least the size of {@link #JAR_MAGIC}. (The same buffer may be reused
           for multiple calls as an optimization.)
src/main/java/org/apache/ibatis/io/DefaultVFS.java