Documentation ¶
Index ¶
- func MarshalByte(v byte, buf []byte) (int, error)
- func MarshalBytes(v []byte, buf []byte) (int, error)
- func MarshalString(v string, buf []byte) (int, error)
- func MarshalUint(v uint, buf []byte) (int, error)
- func MarshalUint16(v uint16, buf []byte) (int, error)
- func MarshalUint32(v uint32, buf []byte) (int, error)
- func MarshalUint64(v uint64, buf []byte) (int, error)
- func UnmarshalByte(buf []byte) (int, byte, error)
- func UnmarshalBytes(buf []byte, newBuf bool) (int, []byte, error)
- func UnmarshalString(buf []byte, newBuf bool) (int, string, error)
- func UnmarshalUint(buf []byte) (int, uint, error)
- func UnmarshalUint16(buf []byte) (int, uint16, error)
- func UnmarshalUint32(buf []byte) (int, uint32, error)
- func UnmarshalUint64(buf []byte) (int, uint64, error)
- func WritableStringSize(v string) int
- func WritableUintSize(v uint64) int
- func WritebleBytesSize(buf []byte) int
- type ObjectsWriter
- func (ow *ObjectsWriter) WriteByte(v byte) (int, error)
- func (ow *ObjectsWriter) WriteBytes(v []byte) (int, error)
- func (ow *ObjectsWriter) WritePureBytes(v []byte) (int, error)
- func (ow *ObjectsWriter) WritePureString(v string) (int, error)
- func (ow *ObjectsWriter) WriteString(v string) (int, error)
- func (ow *ObjectsWriter) WriteUint(v uint) (int, error)
- func (ow *ObjectsWriter) WriteUint16(v uint16) (int, error)
- func (ow *ObjectsWriter) WriteUint32(v uint32) (int, error)
- func (ow *ObjectsWriter) WriteUint64(v uint64) (int, error)
- type Writable
- type WritableString
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalByte ¶
MarshalByte writes value v to the buf. Returns number of bytes written or an error, if any
func MarshalBytes ¶
MarshalBytes writes value v to the buf. Returns number of bytes written or an error, if any
func MarshalString ¶
MarshalString writes value v to the buf. Returns number of bytes written or an error, if any
func MarshalUint ¶
MarshalUint writes value v to the buf. Returns number of bytes written or an error, if any
func MarshalUint16 ¶
MarshalUint16 writes value v to the buf. Returns number of bytes written or an error, if any
func MarshalUint32 ¶
MarshalUint32 writes value v to the buf. Returns number of bytes written or an error, if any
func MarshalUint64 ¶
MarshalUint64 writes value v to the buf. Returns number of bytes written or an error, if any
func UnmarshalByte ¶
UnmarshalByte reads next byte value from the buf. Retruns number of bytes read, the value or an error, if any.
func UnmarshalBytes ¶
UnmarshalBytes reads next []byte value from the buf. It retruns number of bytes read, the value or an error, if any.
func UnmarshalString ¶
UnmarshalString reads next string value from the buf. It retruns number of bytes read, the value or an error, if any.
func UnmarshalUint ¶
UnmarshalUint reads next uint value from the buf. It retruns number of bytes read, the value or an error, if any.
func UnmarshalUint16 ¶
UnmarshalUint16 reads next uint16 value from the buf. Retruns number of bytes read, the value or an error, if any.
func UnmarshalUint32 ¶
UnmarshalUint32 reads next uint32 value from the buf. Retruns number of bytes read, the value or an error, if any.
func UnmarshalUint64 ¶
UnmarshalUint64 reads next int64 value from the buf. Retruns number of bytes read, the value or an error, if any.
func WritableStringSize ¶
WritableStringSize returns size of encoded v
func WritableUintSize ¶
WritableUintSize returns size of encoded uint64 size
func WritebleBytesSize ¶
WritebleBytesSize returns size of encoded buf
Types ¶
type ObjectsWriter ¶
func (*ObjectsWriter) WriteByte ¶
func (ow *ObjectsWriter) WriteByte(v byte) (int, error)
WriteByte writes value v to the writer. It returns number of bytes written or an error if any.
func (*ObjectsWriter) WriteBytes ¶
func (ow *ObjectsWriter) WriteBytes(v []byte) (int, error)
WriteBytes writes unmarshalable v to the writer. The written value could be unmarshaled by UnmarshalBytes, It contains a header - length of the bytes slice at the beginning. The method returns number of bytes written or an error if any.
func (*ObjectsWriter) WritePureBytes ¶
func (ow *ObjectsWriter) WritePureBytes(v []byte) (int, error)
WritePureBytes writes value v to the writer. It returns number of bytes written or an error if any.
func (*ObjectsWriter) WritePureString ¶
func (ow *ObjectsWriter) WritePureString(v string) (int, error)
WritePureString writes value v to writer w. It returns number of bytes written or an error if any.
func (*ObjectsWriter) WriteString ¶
func (ow *ObjectsWriter) WriteString(v string) (int, error)
WriteString writes unmarshalable v to the writer. The written value could be unmarshaled by UnmarshalString, It contains a header - length of the bytes slice at the beginning. The method returns number of bytes written or an error if any.
func (*ObjectsWriter) WriteUint ¶
func (ow *ObjectsWriter) WriteUint(v uint) (int, error)
WriteUint writes value v to the writer with the variable size. It returns number of bytes written or an error if any.
func (*ObjectsWriter) WriteUint16 ¶
func (ow *ObjectsWriter) WriteUint16(v uint16) (int, error)
WriteUint16 writes value v to the writer. It returns number of bytes written or an error if any.
func (*ObjectsWriter) WriteUint32 ¶
func (ow *ObjectsWriter) WriteUint32(v uint32) (int, error)
WriteUint32 writes value v to the writer. It returns number of bytes written or an error if any.
func (*ObjectsWriter) WriteUint64 ¶
func (ow *ObjectsWriter) WriteUint64(v uint64) (int, error)
WriteUint64 writes value v to the writer. It returns number of bytes written or an error if any.
type Writable ¶
type Writable interface { // WritableSize returns how many bytes the marshalled object form takes WritableSize() int // WriteTo allows to write (marshal) the object into the writer. If no // error happens, the function will write number of bytes returned by the WritableSize() function // it returns number of bytes written and an error, if any WriteTo(writer *ObjectsWriter) (int, error) }
Writable interface is implemented by objects that could be written into io.Writer. The objects that support the interface must provide the size of the object in binary form and the function for writing the object into a Writer.
type WritableString ¶
type WritableString string
WritableString a string which implements Writable
func (WritableString) WritableSize ¶
func (ws WritableString) WritableSize() int
WritableSize is part of Writable for WritableString
func (WritableString) WriteTo ¶
func (ws WritableString) WriteTo(writer *ObjectsWriter) (int, error)
WriteTo is part of Writable for WritableString