Documentation
¶
Overview ¶
Package archive extracts Java archive files.
Index ¶
- Constants
- func NewOmitEmptyLinesReader(r io.Reader) io.Reader
- type Config
- type Extractor
- func (Extractor) Ecosystem(i *extractor.Inventory) string
- func (e Extractor) Extract(ctx context.Context, input *filesystem.ScanInput) ([]*extractor.Inventory, error)
- func (e Extractor) FileRequired(api filesystem.FileAPI) bool
- func (e Extractor) Name() string
- func (e Extractor) Requirements() *plugin.Capabilities
- func (e Extractor) ToPURL(i *extractor.Inventory) *purl.PackageURL
- 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 ¶
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 // MaxFileSizeBytes is the maximum size of a file that can be extracted. // If this limit is greater than zero and a file is encountered that is larger // than this limit, the file is ignored by returning false for `FileRequired`. MaxFileSizeBytes int64 // 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 // Stats is a stats collector for reporting metrics. Stats stats.Collector }
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) Ecosystem ¶ added in v0.1.3
Ecosystem returns the OSV Ecosystem of the software extracted by this extractor.
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 ¶
func (e Extractor) FileRequired(api filesystem.FileAPI) bool
FileRequired returns true if the specified file matches java archive file patterns.
func (Extractor) Requirements ¶ added in v0.1.3
func (e Extractor) Requirements() *plugin.Capabilities
Requirements of the extractor.
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.