item.go
func (m *Nitro) EncodeItem(itm *Item, buf []byte, w io.Writer) error {
	l := 2
	if len(buf) < l {
		return errNotEnoughSpace
	}

	binary.BigEndian.PutUint16(buf[0:2], uint16(itm.dataLen))
	if _, err := w.Write(buf[0:2]); err != nil {
		return err
	}
	if _, err := w.Write(itm.Bytes()); err != nil {
		return err
	}

	return nil
}
func (m *Nitro) EncodeItem(itm *Item, buf []byte, w io.Writer) error {
	l := 2
	if len(buf) < l {
		return errNotEnoughSpace
	}

	binary.BigEndian.PutUint16(buf[0:2], uint16(itm.dataLen))
	if _, err := w.Write(buf[0:2]); err != nil {
		return err
	}
	if _, err := w.Write(itm.Bytes()); err != nil {
		return err
	}

	return nil
}
// EncodeItem encodes in [2 byte len][item_bytes] format.