WriteInt8 write int8 with the tag.
(data int8, tag byte)
| 190 | |
| 191 | // WriteInt8 write int8 with the tag. |
| 192 | func (b *Buffer) WriteInt8(data int8, tag byte) error { |
| 193 | var err error |
| 194 | if data == 0 { |
| 195 | if err = b.WriteHead(ZeroTag, tag); err != nil { |
| 196 | return err |
| 197 | } |
| 198 | } else { |
| 199 | if err = b.WriteHead(BYTE, tag); err != nil { |
| 200 | return err |
| 201 | } |
| 202 | |
| 203 | if err = b.buf.WriteByte(byte(data)); err != nil { |
| 204 | return err |
| 205 | } |
| 206 | } |
| 207 | return nil |
| 208 | } |
| 209 | |
| 210 | // WriteUint8 write uint8 with the tag |
| 211 | func (b *Buffer) WriteUint8(data uint8, tag byte) error { |