func (util *MarshalUtil) Write(object SimpleBinaryMarshaler) *MarshalUtil {
	return util.WriteBytes(object.Bytes())
}
Write marshals the given object by writing its Bytes into the underlying 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))
	}
}