func (util *MarshalUtil) WriteOffset() int {
	return util.writeOffset
}
WriteOffset returns the current write offset of the internal buffer.
package marshalutil
import (
	"fmt"
)
type MarshalUtil struct {
	bytes       []byte
	readOffset  int
	writeOffset int
	size        int
}
func New(args ...interface{}) *MarshalUtil {
	switch argsCount := len(args); argsCount {
	case 0:
		return &MarshalUtil{
			bytes: make([]byte, 1024),
			size:  1024,
		}
	case 1:
		switch param := args[0].(type) {
		case int:
			return &MarshalUtil{
				bytes: make([]byte, param),
				size:  param,
			}
		case []byte:
			return &MarshalUtil{
				bytes: param,
				size:  len(param),
			}
		default:
			panic(fmt.Errorf("illegal argument type %T in marshalutil.New(...)", param))
		}
	default:
		panic(fmt.Errorf("illegal argument count %d in marshalutil.New(...)", argsCount))
	}
}
func (util *MarshalUtil) Write(object SimpleBinaryMarshaler) *MarshalUtil {
	return util.WriteBytes(object.Bytes())
}
func (util *MarshalUtil) Parse(parser func(data []byte) (interface{}, int, error)) (result interface{}, err error) {
	result, readBytes, err := parser(util.bytes[util.readOffset:])
	if err == nil {
		util.ReadSeek(util.readOffset + readBytes)
	}
	return
}
func (util *MarshalUtil) ReadOffset() int {
	return util.readOffset
}