Documentation ¶
Index ¶
- func CompactSize(n uint64) []byte
- type Buffer
- func (buf *Buffer) Close()
- func (buf *Buffer) Peek(length int) ([]byte, error)
- func (buf *Buffer) ReadByte() (byte, error)
- func (buf *Buffer) ReadBytes(length uint64) []byte
- func (buf *Buffer) ReadCompactSize() uint64
- func (buf *Buffer) ReadInt32() int32
- func (buf *Buffer) ReadInt64() int64
- func (buf *Buffer) ReadUint16() uint16
- func (buf *Buffer) ReadUint32() uint32
- func (buf *Buffer) ReadUint64() uint64
- func (buf *Buffer) ReadVarint() uint64
- func (buf *Buffer) Reset()
- func (buf *Buffer) Seek(pos int64, whence int) (int64, error)
- func (buf *Buffer) Type() string
- type File
- func (file *File) Close()
- func (file *File) Peek(length int) ([]byte, error)
- func (file *File) ReadByte() (byte, error)
- func (file *File) ReadBytes(length uint64) []byte
- func (file *File) ReadCompactSize() uint64
- func (file *File) ReadInt32() int32
- func (file *File) ReadInt64() int64
- func (file *File) ReadUint16() uint16
- func (file *File) ReadUint32() uint32
- func (file *File) ReadUint64() uint64
- func (file *File) ReadVarint() uint64
- func (file *File) Reset()
- func (file *File) Seek(offset int64, whence int) (int64, error)
- func (file *File) Size() (int64, error)
- func (file *File) Type() string
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompactSize ¶
CompactSize convert an int to a series of 1 to 8 bytes Used for scriptLength, NVin, NVout, witnessCount
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer allows to use the Reader interface when storing data in memory
func (*Buffer) ReadCompactSize ¶
ReadCompactSize reads N byte of data as uint64, LE. N depends on the first byte
func (*Buffer) ReadUint16 ¶
ReadUint16 reads next 4 bytes of data as uint16, LE
func (*Buffer) ReadUint32 ¶
ReadUint32 reads next 8 bytes of data as uint32, LE
func (*Buffer) ReadUint64 ¶
ReadUint64 reads next 16 bytes of data as uint64, LE
func (*Buffer) ReadVarint ¶
ReadVarint reads N byte of data as uint64, LE. N depends on the first byte
type File ¶
type File struct { NFile uint32 // file number // contains filtered or unexported fields }
File allows to use the Reader interface when reading a file
func (*File) ReadCompactSize ¶
ReadCompactSize reads N byte of data as uint64, LE. N depends on the first byte
func (*File) ReadUint16 ¶
ReadUint16 reads next 4 bytes of data as uint16, LE
func (*File) ReadUint32 ¶
ReadUint32 reads next 8 bytes of data as uint32, LE
func (*File) ReadUint64 ¶
ReadUint64 reads next 16 bytes of data as uint64, LE
func (*File) ReadVarint ¶
ReadVarint does not work for file TODO: Implement it
type Reader ¶
type Reader interface { Type() string Peek(int) ([]byte, error) Seek(int64, int) (int64, error) Reset() ReadByte() (byte, error) ReadBytes(uint64) []byte ReadUint32() uint32 ReadUint64() uint64 ReadInt32() int32 ReadVarint() uint64 ReadCompactSize() uint64 ReadUint16() uint16 Close() }
Reader is an interface used to decode blocks and transactions it allows to apply the same functions to files and buffers