Skip to content

io microsphere io scanner SimpleJarEntryScanner

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

SimpleJarEntryScanner

Type: Class | Module: microsphere-java-core | Package: io.microsphere.io.scanner | Since: 1.0.0

Source: microsphere-java-core/src/main/java/io/microsphere/io/scanner/SimpleJarEntryScanner.java

Overview

A simple scanner for JarEntry that provides methods to scan and filter entries within a JAR file.

This class allows recursive or non-recursive scanning of JAR entries, optionally applying a filter to match specific entries. It returns an immutable set of matching jar entries.

Example Usage

`// Example 1: Scan all entries recursively from a JAR URL
SimpleJarEntryScanner scanner = new SimpleJarEntryScanner();
URL jarUrl = new URL("jar:file:/path/to/your.jar!/");
Set entries = scanner.scan(jarUrl, true);
`
`// Example 2: Scan with a filter to find only .class files
JarEntryFilter filter = entry -> entry.getName().endsWith(".class");
Set classEntries = scanner.scan(jarUrl, true, filter);
`
`// Example 3: Scan a specific directory inside a JarFile non-recursively
JarFile jarFile = new JarFile("/path/to/your.jar");
Set entries = scanner.scan(jarFile, false);
`

Declaration

public class SimpleJarEntryScanner

Author: Mercy

Version Information

  • Introduced in: 1.0.0
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

Example 1

// Example 1: Scan all entries recursively from a JAR URL
SimpleJarEntryScanner scanner = new SimpleJarEntryScanner();
URL jarUrl = new URL("jar:file:/path/to/your.jar!/");
Set<JarEntry> entries = scanner.scan(jarUrl, true);

Example 2

// Example 2: Scan with a filter to find only .class files
JarEntryFilter filter = entry -> entry.getName().endsWith(".class");
Set<JarEntry> classEntries = scanner.scan(jarUrl, true, filter);

Example 3

// Example 3: Scan a specific directory inside a JarFile non-recursively
JarFile jarFile = new JarFile("/path/to/your.jar");
Set<JarEntry> entries = scanner.scan(jarFile, false);

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.io.scanner.SimpleJarEntryScanner;

API Reference

Public Methods

Method Description
scan Singleton
scan
scan
scan

Method Details

scan

public Set<JarEntry> scan(URL jarURL, final boolean recursive)

Singleton / public static final SimpleJarEntryScanner INSTANCE = new SimpleJarEntryScanner();

public SimpleJarEntryScanner() { }

/**

See Also

  • JarEntry
  • JarFile
  • JarEntryFilter

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally