reader

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFormatUnserializer added in v0.2.0

func GetFormatUnserializer(format formats.Format) (native.Unserializer, error)

func RegisterUnserializer added in v0.2.0

func RegisterUnserializer(format formats.Format, u native.Unserializer)

RegisterUnserializer registers a new unserializer to parse a specific format. The new unserializer replaces any previously defined driver.

func UnregisterUnserializer added in v0.2.0

func UnregisterUnserializer(format formats.Format)

UnregisterUnserializer removes a serializer from the list of available

Types

type Options added in v0.2.0

type Options struct {
	Format             formats.Format
	UnserializeOptions *native.UnserializeOptions
	// contains filtered or unexported fields
}

func (*Options) GetFormatOptions added in v0.2.0

func (o *Options) GetFormatOptions(key interface{}) interface{}

func (*Options) SetFormatOptions added in v0.2.0

func (o *Options) SetFormatOptions(key, opts interface{})

type Reader

type Reader struct {
	Options *Options
	// contains filtered or unexported fields
}

func New

func New(opts ...ReaderOption) *Reader

func (*Reader) ParseFile

func (r *Reader) ParseFile(path string) (*sbom.Document, error)

ParseFile reads a file and returns an sbom.Document

func (*Reader) ParseFileWithOptions added in v0.2.0

func (r *Reader) ParseFileWithOptions(path string, o *Options) (*sbom.Document, error)

ParseFile reads a file and returns an sbom.Document

func (*Reader) ParseStream

func (r *Reader) ParseStream(f io.ReadSeeker) (*sbom.Document, error)

ParseStreamWithOptions returns a document from a ioreader

func (*Reader) ParseStreamWithOptions added in v0.2.0

func (r *Reader) ParseStreamWithOptions(f io.ReadSeeker, o *Options) (*sbom.Document, error)

ParseStreamWithOptions returns a document from a ioreader, accept options for unserializer

type ReaderOption added in v0.2.0

type ReaderOption func(*Reader)

func WithFormatOptions added in v0.2.0

func WithFormatOptions(driverKey string, opts interface{}) ReaderOption

func WithSniffer added in v0.2.0

func WithSniffer(s Sniffer) ReaderOption

func WithUnserializeOptions added in v0.2.0

func WithUnserializeOptions(uo *native.UnserializeOptions) ReaderOption

type Sniffer added in v0.2.0

type Sniffer interface {
	SniffReader(rs io.ReadSeeker) (formats.Format, error)
	SniffFile(path string) (formats.Format, error)
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL