Documentation ¶
Index ¶
- type BinaryReader
- func (b *BinaryReader) ReadBoolean(offset int64) (bool, error)
- func (b *BinaryReader) ReadByte(offset int64) (byte, error)
- func (b *BinaryReader) ReadBytes(offset int64, buf []byte) (int, error)
- func (b *BinaryReader) ReadInt16(off int64) (int16, error)
- func (b *BinaryReader) ReadInt32(off int64) (int32, error)
- func (b *BinaryReader) ReadInt64(off int64) (int64, error)
- func (b *BinaryReader) ReadUInt16(offset int64) (uint16, error)
- func (b *BinaryReader) ReadUInt32(off int64) (uint32, error)
- func (b *BinaryReader) ReadUInt64(off int64) (uint64, error)
- func (b *BinaryReader) ReadUUID(off int64) (*common.UUID, error)
- type ReadAtReader
- type VhdReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryReader ¶
type BinaryReader struct { Size int64 // contains filtered or unexported fields }
BinaryReader is the reader which can be used to read values of primitive types from a reader The reader supports reading data stored both in little-endian or big-endian format.
func NewBinaryReader ¶
func NewBinaryReader(from ReadAtReader, order binary.ByteOrder, size int64) *BinaryReader
NewBinaryReader creates a new instance of BinaryReader, from is the underlying data source to read from, order is the byte order used to encode the data in the source, size is the length of the data source in bytes.
func (*BinaryReader) ReadBoolean ¶
func (b *BinaryReader) ReadBoolean(offset int64) (bool, error)
ReadBoolean reads a byte from underlying source starting at byte offset off and returns it as a bool.
func (*BinaryReader) ReadByte ¶
func (b *BinaryReader) ReadByte(offset int64) (byte, error)
ReadByte reads a byte from underlying source starting at byte offset off and returns it.
func (*BinaryReader) ReadBytes ¶
func (b *BinaryReader) ReadBytes(offset int64, buf []byte) (int, error)
ReadBytes reads exactly len(buf) bytes from r into buf. It returns the number of bytes copied and an error if fewer bytes were read. The error is EOF only if no bytes were read. If an EOF happens after reading some but not all the bytes, ReadBytes returns ErrUnexpectedEOF. On return, n == len(buf) if and only if err == nil.
func (*BinaryReader) ReadInt16 ¶
func (b *BinaryReader) ReadInt16(off int64) (int16, error)
ReadInt16 reads an encoded signed 2 byte integer from underlying source starting at byte offset off returns it as a int16.
func (*BinaryReader) ReadInt32 ¶
func (b *BinaryReader) ReadInt32(off int64) (int32, error)
ReadInt32 reads an encoded signed 4 byte integer from underlying source starting at byte offset off and returns it as a int32.
func (*BinaryReader) ReadInt64 ¶
func (b *BinaryReader) ReadInt64(off int64) (int64, error)
ReadInt64 reads an encoded signed 4 byte integer from underlying source starting at byte offset off and and returns it as a int64.
func (*BinaryReader) ReadUInt16 ¶
func (b *BinaryReader) ReadUInt16(offset int64) (uint16, error)
ReadUInt16 reads an encoded unsigned 2 byte integer from underlying source starting at byte offset off and return it as a uint16.
func (*BinaryReader) ReadUInt32 ¶
func (b *BinaryReader) ReadUInt32(off int64) (uint32, error)
ReadUInt32 reads an encoded unsigned 4 byte integer from underlying source starting at byte offset off returns it as a uint32.
func (*BinaryReader) ReadUInt64 ¶
func (b *BinaryReader) ReadUInt64(off int64) (uint64, error)
ReadUInt64 reads an encoded unsigned 8 byte integer from underlying source starting at byte offset off and returns it as a uint64.
type ReadAtReader ¶
ReadAtReader interface that composes io.ReaderAt and io.Reader interfaces.
type VhdReader ¶
type VhdReader struct {
*BinaryReader
}
VhdReader is the reader used by various components responsible for reading different segments of VHD such as header, footer, BAT, block, bitmap and sector.
func NewVhdReader ¶
func NewVhdReader(source ReadAtReader, size int64) *VhdReader
NewVhdReader creates new instance of the VhdReader, that reads from the underlying source, size is the size of the source in bytes.
func NewVhdReaderFromByteSlice ¶
NewVhdReaderFromByteSlice creates a new instance of VhdReader, that uses the given byte slice as the underlying source to read from.