Documentation
¶
Overview ¶
Package archive extracts Java archive files.
Index ¶
- Constants
- type Config
- type Extractor
- func (e Extractor) Extract(ctx context.Context, input *filesystem.ScanInput) ([]*extractor.Inventory, error)
- func (e Extractor) FileRequired(path string, _ fs.FileMode) bool
- func (e Extractor) Name() string
- func (e Extractor) ToCPEs(i *extractor.Inventory) ([]string, error)
- func (e Extractor) ToPURL(i *extractor.Inventory) (*purl.PackageURL, error)
- func (e Extractor) Version() int
- type JarProps
- type Metadata
- type PomProps
Constants ¶
const (
// Name is the unique name of this extractor.
Name = "java/archive"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // MaxZipDepth is the maximum number of inner zip files within an archive the extractor will unzip. // Once reached, no more inner zip files will be explored during extraction. MaxZipDepth int // MaxOpenedBytes is the maximum number of bytes recursively read from an archive file. // If this limit is reached, extraction is halted and results so far are returned. MaxOpenedBytes int64 // MinZipBytes is use to ignore empty zip files during extraction. // Zip files smaller than minZipBytes are ignored. MinZipBytes int // ExtractFromFilename configures if JAR files should be extracted from filenames when no "pom.properties" is present. ExtractFromFilename bool // HashJars configures if JAR files should be hashed with base64(sha1()), which can be used in deps.dev. HashJars bool }
Config is the configuration for the Extractor.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default configuration for the Java archive extractor.
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor extracts Java packages from archive files.
func New ¶
New returns a Java archive extractor.
For most use cases, initialize with: ``` e := New(DefaultConfig()) ```
func (Extractor) Extract ¶
func (e Extractor) Extract(ctx context.Context, input *filesystem.ScanInput) ([]*extractor.Inventory, error)
Extract extracts java packages from archive files passed through input.
func (Extractor) FileRequired ¶
FileRequired returns true if the specified file matches java archive file patterns.
func (Extractor) ToCPEs ¶
ToCPEs is not applicable as this extractor does not infer CPEs from the Inventory.
type JarProps ¶
JarProps stores the name, version, and group ID of a Java archive.
func ParseFilename ¶
ParseFilename attempts to figure out the package name, version, and group ID of a Java archive based on its filename. Returns nil if parsing was unsuccessful.