iso9660

package module
v0.0.0-...-604955a Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: MIT Imports: 11 Imported by: 1

README

A Go package for reading ISO9660 filesystems.
Extensions such as Joliet or Rock Ridge is not implemented.

Documentation

Overview

Package ISO9660 implements a basic reader for the ISO9660 filesystem. Extensions such as Joliet or Rock Ridge is not implemented.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIsDir  = errors.New("is a directory")
	ErrNotDir = errors.New("not a directory")
)

Functions

This section is empty.

Types

type Buffer

type Buffer interface {
	io.ReaderAt
	io.Closer
	Size() int64
}

Buffer is an interface providing a method to get the length of the buffer and random access to it.

type File

type File struct {
	// contains filtered or unexported fields
}

File represents a directory entry inside an ISO.

func (*File) Close

func (f *File) Close() error

Close closes the file.

func (*File) Name

func (f *File) Name() string

Name returns the filename.

func (*File) Read

func (f *File) Read(p []byte) (n int, err error)

Read reads data from the file into the buffer.

func (*File) ReadAt

func (f *File) ReadAt(p []byte, off int64) (n int, err error)

ReadAt reads the data from the file at an offset into the buffer.

func (*File) Readdir

func (f *File) Readdir(n int) (fi []os.FileInfo, err error)

Readdir reads a directory.

func (*File) Readdirnames

func (f *File) Readdirnames(n int) (names []string, err error)

Readdirnames reads a directory and returns up to n names in the directory. Use n <= 0 to get all the names.

func (*File) Seek

func (f *File) Seek(off int64, whence int) (int64, error)

Seeks seeks the file to offset based on relative whence.

func (*File) Stat

func (f *File) Stat() (fi os.FileInfo, err error)

Stat returns the file information.

type FileSystem

type FileSystem struct {
	// contains filtered or unexported fields
}

FileSystem represents a ISO9660 file system.

func NewFileSystem

func NewFileSystem(r Reader) (*FileSystem, error)

NewFileSystem makes a FileSystem from a Reader

func Open

func Open(name ...string) (*FileSystem, error)

Open creates an ISO9660 filesystem out of OS files.

func (*FileSystem) Chdir

func (fs *FileSystem) Chdir(dir string) error

Chdir changes the filesystem current working directory. There will be an error returned if it is not a valid directory.

func (*FileSystem) Close

func (fs *FileSystem) Close() error

Close closes the reader that the filesystem is using.

func (*FileSystem) Getwd

func (fs *FileSystem) Getwd() (string, error)

Getwd gets the current working directory.

func (*FileSystem) Open

func (fs *FileSystem) Open(name string) (*File, error)

Open opens a file.

type Image

type Image struct {
	Buffer
	// contains filtered or unexported fields
}

An Image represents a CD image that treats a Buffer as if it was composed of sectors.

func NewImage

func NewImage(b Buffer) (*Image, error)

NewImage makes an image out of a Buffer. Image turns a buffer into a run of sectors, like a conventional CD image would be composed of.

func (*Image) NumSectors

func (m *Image) NumSectors() int64

NumSectors returns the number of sectors the image contains.

func (*Image) ReadSector

func (m *Image) ReadSector(lba int64, b []byte) (n int, err error)

ReadSector reads the sector lba and stores it into the buffer. Use the SectorSize to determine how big the buffer should be.

func (*Image) SectorSize

func (m *Image) SectorSize() int64

SectorSize returns the sector size of the image.

type MultiFile

type MultiFile struct {
	// contains filtered or unexported fields
}

MultiFile creates concatenation out of a list files and treats them as one contiguous file.

func NewMultiFile

func NewMultiFile(name ...string) (*MultiFile, error)

NewMultiFile makes a MultiFile out of a set of the OS files. It will treat the inorder list of files as one contiguous buffer.

func (*MultiFile) Close

func (r *MultiFile) Close() error

Close closes the file.

func (*MultiFile) Read

func (r *MultiFile) Read(p []byte) (int, error)

Read reads data from the buffer.

func (*MultiFile) ReadAt

func (r *MultiFile) ReadAt(p []byte, off int64) (int, error)

ReadAt reads the data at an offset.

func (*MultiFile) Seek

func (r *MultiFile) Seek(off int64, whence int) (int64, error)

Seek seeks to an offset relative to whence.

func (*MultiFile) Size

func (r *MultiFile) Size() int64

Size returns the length of all the files combined.

type Reader

type Reader interface {
	NumSectors() int64
	SectorSize() int64
	ReadSector(lba int64, b []byte) (int, error)
	io.Closer
}

Reader provides an interface for reading sectors, it simulates what a CD drive provides.

Jump to

Keyboard shortcuts

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