Documentation
¶
Overview ¶
Package iso9660 implements reading and creating basic ISO9660 images.
Index ¶
- Constants
- Variables
- func MarshalString(s string, padToLength int) []byte
- func UnmarshalInt16LSBMSB(data []byte) (int16, error)
- func UnmarshalInt32LSBMSB(data []byte) (int32, error)
- func UnmarshalUint32LSBMSB(data []byte) (uint32, error)
- func WriteInt16LSBMSB(dst []byte, value int16)
- func WriteInt32LSBMSB(dst []byte, value int32)
- type BootVolumeDescriptorBody
- type ContinuationEntry
- type DirectoryEntry
- type ExtensionRecord
- type File
- func (f *File) GetAllChildren() ([]*File, error)
- func (f *File) GetChildren() ([]*File, error)
- func (f *File) GetDotEntry() (*File, error)
- func (f *File) IsDir() bool
- func (f *File) ModTime() time.Time
- func (f *File) Mode() os.FileMode
- func (f *File) Name() string
- func (f *File) Reader() io.Reader
- func (f *File) Size() int64
- func (f *File) Sys() interface{}
- type Image
- type ImageWriter
- func (iw *ImageWriter) AddFile(data io.Reader, filePath string) error
- func (iw *ImageWriter) AddLocalDirectory(origin, target string) error
- func (iw *ImageWriter) AddLocalFile(origin, target string) error
- func (iw *ImageWriter) Cleanup() error
- func (iw *ImageWriter) WriteTo(w io.Writer, volumeIdentifier string) error
- type PrimaryVolumeDescriptorBody
- type RecordingTimestamp
- type RockRidgeEntryType
- type RockRidgeNameEntry
- type SPRecord
- type SUSPMetadata
- type SystemUseEntry
- type SystemUseEntrySlice
- type VolumeDescriptorTimestamp
- Bugs
Constants ¶
const ( RockRidgeIdentifier = "RRIP_1991A" RockRidgeVersion = 1 )
const ( SUEType_ContinuationArea = "CE" SUEType_PaddingField = "PD" SUEType_SharingProtocolIndicator = "SP" SUEType_SharingProtocolTerminator = "ST" SUEType_ExtensionsReference = "ER" SUEType_ExtensionSelector = "ES" )
Variables ¶
var ( // ErrFileTooLarge is returned when trying to process a file of size greater // than 4GB, which due to the 32-bit address limitation is not possible // except with ISO 9660-Level 3 ErrFileTooLarge = errors.New("file is exceeding the maximum file size of 4GB") )
var ErrUDFNotSupported = errors.New("UDF volumes are not supported")
Functions ¶
func MarshalString ¶
MarshalString encodes the given string as a byte array padded to the given length
func UnmarshalInt16LSBMSB ¶
UnmarshalInt16LSBMSB decodes a 16-bit integer in both byte orders, as defined in ECMA-119 7.3.3
func UnmarshalInt32LSBMSB ¶
UnmarshalInt32LSBMSB decodes a 32-bit integer in both byte orders, as defined in ECMA-119 7.3.3
func UnmarshalUint32LSBMSB ¶
UnmarshalUint32LSBMSB is the same as UnmarshalInt32LSBMSB but returns an unsigned integer
func WriteInt16LSBMSB ¶
WriteInt16LSBMSB writes a 16-bit integer in both byte orders, as defined in ECMA-119 7.2.3
func WriteInt32LSBMSB ¶
WriteInt32LSBMSB writes a 32-bit integer in both byte orders, as defined in ECMA-119 7.3.3
Types ¶
type BootVolumeDescriptorBody ¶
type BootVolumeDescriptorBody struct { BootSystemIdentifier string BootIdentifier string BootSystemUse [1977]byte }
BootVolumeDescriptorBody represents the data in bytes 7-2047 of a Boot Record as defined in ECMA-119 8.2
func (*BootVolumeDescriptorBody) UnmarshalBinary ¶
func (bvd *BootVolumeDescriptorBody) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes a BootVolumeDescriptorBody from binary form
type ContinuationEntry ¶
type ContinuationEntry struct {
// contains filtered or unexported fields
}
SUSP-112 5.1
type DirectoryEntry ¶
type DirectoryEntry struct { ExtendedAtributeRecordLength byte ExtentLocation int32 ExtentLength uint32 RecordingDateTime RecordingTimestamp FileFlags byte FileUnitSize byte InterleaveGap byte VolumeSequenceNumber int16 Identifier string SystemUse []byte SystemUseEntries SystemUseEntrySlice }
DirectoryEntry contains data from a Directory Descriptor as described by ECMA-119 9.1
func (*DirectoryEntry) Clone ¶
func (de *DirectoryEntry) Clone() DirectoryEntry
Clone creates a copy of the DirectoryEntry
func (*DirectoryEntry) MarshalBinary ¶
func (de *DirectoryEntry) MarshalBinary() ([]byte, error)
MarshalBinary encodes a DirectoryEntry to binary form
func (*DirectoryEntry) UnmarshalBinary ¶
func (de *DirectoryEntry) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary decodes a DirectoryEntry from binary form
type ExtensionRecord ¶
func ExtensionRecordDecode ¶
func ExtensionRecordDecode(e SystemUseEntry) (*ExtensionRecord, error)
See SUSP-112 5.5
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is a os.FileInfo-compatible wrapper around an ISO9660 directory entry
func (*File) GetAllChildren ¶
GetAllChildren returns the children entries in case of a directory or an error in case of a file. It includes the "." and ".." entries.
func (*File) GetChildren ¶
GetChildren returns the children entries in case of a directory or an error in case of a file. It does NOT include the "." and ".." entries.
func (*File) GetDotEntry ¶
GetDotEntry returns the "." entry of a directory or an error in case of a file.
func (*File) Mode ¶
Mode returns file mode when available. Otherwise it returns os.FileMode flag set with the os.ModeDir flag enabled in case of directories.
func (*File) Reader ¶
Reader returns a reader that allows to read the file's data. If File is a directory, it returns nil.
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image is a wrapper around an image file that allows reading its ISO9660 data
type ImageWriter ¶
type ImageWriter struct {
// contains filtered or unexported fields
}
ImageWriter is responsible for staging an image's contents and writing them to an image.
func NewWriter ¶
func NewWriter() (*ImageWriter, error)
NewWriter creates a new ImageWrite and initializes its temporary staging dir. Cleanup should be called after the ImageWriter is no longer needed.
func (*ImageWriter) AddFile ¶
func (iw *ImageWriter) AddFile(data io.Reader, filePath string) error
AddFile adds a file to the ImageWriter's staging area. All path components are mangled to match basic ISO9660 filename requirements.
func (*ImageWriter) AddLocalDirectory ¶
func (iw *ImageWriter) AddLocalDirectory(origin, target string) error
AddLocalDirectory adds a directory recursively to the ImageWriter's staging area.
func (*ImageWriter) AddLocalFile ¶
func (iw *ImageWriter) AddLocalFile(origin, target string) error
AddLocalFile adds a file identified by its path to the ImageWriter's staging area.
func (*ImageWriter) Cleanup ¶
func (iw *ImageWriter) Cleanup() error
Cleanup deletes the underlying temporary staging directory of an ImageWriter. It can be called multiple times without issues.
type PrimaryVolumeDescriptorBody ¶
type PrimaryVolumeDescriptorBody struct { SystemIdentifier string VolumeIdentifier string VolumeSpaceSize int32 VolumeSetSize int16 VolumeSequenceNumber int16 LogicalBlockSize int16 PathTableSize int32 TypeLPathTableLoc int32 OptTypeLPathTableLoc int32 TypeMPathTableLoc int32 OptTypeMPathTableLoc int32 RootDirectoryEntry *DirectoryEntry VolumeSetIdentifier string PublisherIdentifier string DataPreparerIdentifier string ApplicationIdentifier string CopyrightFileIdentifier string AbstractFileIdentifier string BibliographicFileIdentifier string VolumeCreationDateAndTime VolumeDescriptorTimestamp VolumeModificationDateAndTime VolumeDescriptorTimestamp VolumeExpirationDateAndTime VolumeDescriptorTimestamp VolumeEffectiveDateAndTime VolumeDescriptorTimestamp FileStructureVersion byte ApplicationUsed [512]byte }
PrimaryVolumeDescriptorBody represents the data in bytes 7-2047 of a Primary Volume Descriptor as defined in ECMA-119 8.4
func (PrimaryVolumeDescriptorBody) MarshalBinary ¶
func (pvd PrimaryVolumeDescriptorBody) MarshalBinary() ([]byte, error)
MarshalBinary encodes the PrimaryVolumeDescriptorBody to its binary form
func (*PrimaryVolumeDescriptorBody) UnmarshalBinary ¶
func (pvd *PrimaryVolumeDescriptorBody) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes a PrimaryVolumeDescriptorBody from binary form as defined in ECMA-119 8.4
type RecordingTimestamp ¶
RecordingTimestamp represents a time and date format that can be encoded according to ECMA-119 9.1.5
func (RecordingTimestamp) MarshalBinary ¶
func (ts RecordingTimestamp) MarshalBinary(dst []byte)
MarshalBinary encodes the RecordingTimestamp in its binary form to a buffer of the length of 7 or more bytes
func (*RecordingTimestamp) UnmarshalBinary ¶
func (ts *RecordingTimestamp) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes a RecordingTimestamp from binary form
type RockRidgeEntryType ¶
type RockRidgeEntryType int
const ( TypeNormalEntry RockRidgeEntryType = iota TypeContinuation TypeCurrentDirectory TypeParentDirectory TypeInvalidEntry )
type RockRidgeNameEntry ¶
type RockRidgeNameEntry struct { Continue bool // Bit 0: Alternate Name continues in the next "NM" entry Current bool // Bit 1: Alternate Name refers to the current directory ("." in POSIX) Parent bool // Bit 2: Alternate Name refers to the parent directory (".." in POSIX) Reserved1 bool // Bit 3: Reserved, should be ZERO Reserved2 bool // Bit 4: Reserved, should be ZERO Reserved3 bool // Bit 5: Historically contains the network node name Reserved4 bool // Bit 6: Unused, reserved for future use Reserved5 bool // Bit 7: Unused, reserved for future use Name string }
func (*RockRidgeNameEntry) Type ¶
func (e *RockRidgeNameEntry) Type() RockRidgeEntryType
type SUSPMetadata ¶
func (*SUSPMetadata) Clone ¶
func (sm *SUSPMetadata) Clone() *SUSPMetadata
type SystemUseEntry ¶
type SystemUseEntry []byte
SUSP-112 4.1
func (SystemUseEntry) Data ¶
func (e SystemUseEntry) Data() []byte
func (SystemUseEntry) Length ¶
func (e SystemUseEntry) Length() int
func (SystemUseEntry) Type ¶
func (e SystemUseEntry) Type() string
type SystemUseEntrySlice ¶
type SystemUseEntrySlice []SystemUseEntry
func (SystemUseEntrySlice) GetExtensionRecords ¶
func (s SystemUseEntrySlice) GetExtensionRecords() ([]*ExtensionRecord, error)
func (SystemUseEntrySlice) GetPosixAttr ¶
func (s SystemUseEntrySlice) GetPosixAttr() (fs.FileMode, error)
func (SystemUseEntrySlice) GetRockRidgeName ¶
func (s SystemUseEntrySlice) GetRockRidgeName() string
type VolumeDescriptorTimestamp ¶
type VolumeDescriptorTimestamp struct { Year int Month int Day int Hour int Minute int Second int Hundredth int Offset int }
VolumeDescriptorTimestamp represents a time and date format that can be encoded according to ECMA-119 8.4.26.1
func VolumeDescriptorTimestampFromTime ¶
func VolumeDescriptorTimestampFromTime(t time.Time) VolumeDescriptorTimestamp
VolumeDescriptorTimestampFromTime converts time.Time to VolumeDescriptorTimestamp
func (*VolumeDescriptorTimestamp) MarshalBinary ¶
func (ts *VolumeDescriptorTimestamp) MarshalBinary() ([]byte, error)
MarshalBinary encodes the timestamp into a binary form
func (*VolumeDescriptorTimestamp) UnmarshalBinary ¶
func (ts *VolumeDescriptorTimestamp) UnmarshalBinary(data []byte) error
UnmarshalBinary decodes a VolumeDescriptorTimestamp from binary form
Notes ¶
Bugs ¶
If there are multiple RR PX entries (which is forbidden by the spec), the reader will use the first one.