Documentation ¶
Index ¶
- type BinReader
- func (br *BinReader) ReadBE(v interface{})
- func (br *BinReader) ReadBytes() []byte
- func (br *BinReader) ReadLE(v interface{})
- func (br *BinReader) ReadString() string
- func (br *BinReader) ReadUnit160(v interface{})
- func (br *BinReader) ReadUnit256(v interface{})
- func (br *BinReader) ReadUnit32(v interface{})
- func (br *BinReader) ReadUnit64Bytes() []byte
- func (br *BinReader) ReadVarUint() uint64
- type BinWriter
- func (bw *BinWriter) WriteAddress(data string)
- func (bw *BinWriter) WriteBytes(data []byte)
- func (bw *BinWriter) WriteInt(data int)
- func (bw *BinWriter) WriteUint256(data neoUtil.Uint256)
- func (bw *BinWriter) WriteUint32(data uint32)
- func (bw *BinWriter) WriteUint64(data uint64)
- func (bw *BinWriter) WriteUint64Bytes(data []byte)
- func (bw *BinWriter) WriteUint8(data uint8)
- func (bw *BinWriter) WriteVarBytes(data []byte)
- func (w *BinWriter) WriteVarUint(val uint64)
- type BufBinWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinReader ¶
type BinReader struct { Err error // contains filtered or unexported fields }
BinReader is a convenient wrapper around a io.Reader and err object Used to simplify error handling when reading into a struct with many fields
func NewBinReaderFromBuf ¶
NewBinReaderFromBuf makes a BinReader from byte buffer.
func NewBinReaderFromIO ¶
NewBinReaderFromIO makes a BinReader from io.Reader.
func (*BinReader) ReadBE ¶
func (br *BinReader) ReadBE(v interface{})
ReadBE reads from the underlying io.Reader into the interface v in big-endian format
func (*BinReader) ReadBytes ¶
ReadBytes reads the next set of bytes from the underlying reader. ReadVarUInt() is used to determine how large that slice is
func (*BinReader) ReadLE ¶
func (br *BinReader) ReadLE(v interface{})
ReadLE reads from the underlying io.Reader into the interface v in little-endian format
func (*BinReader) ReadString ¶
ReadString calls ReadBytes and casts the results as a string
func (*BinReader) ReadUnit160 ¶
func (br *BinReader) ReadUnit160(v interface{})
ReadUnit160 reads from the underlying io.Reader into the interface v in little-endian format
func (*BinReader) ReadUnit256 ¶
func (br *BinReader) ReadUnit256(v interface{})
ReadUnit256 reads from the underlying io.Reader into the interface v in little-endian format
func (*BinReader) ReadUnit32 ¶
func (br *BinReader) ReadUnit32(v interface{})
ReadUnit32 reads from the underlying io.Reader into the interface v in little-endian format
func (*BinReader) ReadUnit64Bytes ¶
ReadUnit64Bytes reads from the underlying io.Reader into the interface v in little-endian format
func (*BinReader) ReadVarUint ¶
ReadVarUint reads a variable-length-encoded integer from the underlying reader
type BinWriter ¶
type BinWriter struct { Err error // contains filtered or unexported fields }
func NewBinWriterFromIO ¶
NewBinWriterFromIO makes a BinWriter from io.Writer.
func (*BinWriter) WriteAddress ¶
func (*BinWriter) WriteBytes ¶
func (*BinWriter) WriteUint256 ¶
func (*BinWriter) WriteUint32 ¶
func (*BinWriter) WriteUint64 ¶
func (*BinWriter) WriteUint64Bytes ¶
func (*BinWriter) WriteUint8 ¶
func (*BinWriter) WriteVarBytes ¶
func (*BinWriter) WriteVarUint ¶
WriteVarUint writes a uint64 into the underlying writer using variable-length encoding
type BufBinWriter ¶
type BufBinWriter struct { *BinWriter // contains filtered or unexported fields }
BufBinWriter is an additional layer on top of BinWriter that automatically creates buffer to write into that you can get after all writes via Bytes().
func NewBufBinWriter ¶
func NewBufBinWriter() *BufBinWriter
NewBufBinWriter makes a BufBinWriter with an empty byte buffer.
func (*BufBinWriter) Bytes ¶
func (bw *BufBinWriter) Bytes() []byte
Bytes returns resulting buffer and makes future writes return an error.
func (*BufBinWriter) Reset ¶
func (bw *BufBinWriter) Reset()
Reset resets the state of the buffer, making it usable again. It can make buffer usage somewhat more efficient, because you don't need to create it again, but beware that the buffer is gonna be the same as the one returned by Bytes(), so if you need that data after Reset() you have to copy it yourself.