2017-02-12 04:13:29 +00:00
|
|
|
package packer
|
|
|
|
|
2017-03-22 18:30:56 +00:00
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
)
|
2017-02-12 04:13:29 +00:00
|
|
|
|
|
|
|
//packerData -- Contains packer data
|
|
|
|
type packerData struct {
|
2017-03-22 21:03:58 +00:00
|
|
|
buffer bytes.Buffer
|
2017-02-12 04:13:29 +00:00
|
|
|
}
|
|
|
|
|
2017-03-22 18:30:56 +00:00
|
|
|
func (p *packerData) AppendString(dataString string) (int, error) {
|
|
|
|
return p.buffer.WriteString(dataString)
|
2017-02-12 04:13:29 +00:00
|
|
|
}
|
2017-02-14 02:36:01 +00:00
|
|
|
|
2017-03-22 18:30:56 +00:00
|
|
|
func (p *packerData) AppendBytes(dataBytes []byte) (int, error) {
|
|
|
|
return p.buffer.Write(dataBytes)
|
2017-02-14 02:36:01 +00:00
|
|
|
}
|
2017-03-03 00:47:59 +00:00
|
|
|
|
|
|
|
//Data --
|
2017-03-22 18:30:56 +00:00
|
|
|
func (p *packerData) Data() []byte {
|
|
|
|
return p.buffer.Bytes()
|
2017-03-03 00:47:59 +00:00
|
|
|
}
|
2017-03-22 21:03:58 +00:00
|
|
|
|
|
|
|
func (p *packerData) DataLen() int {
|
|
|
|
return p.buffer.Len()
|
|
|
|
}
|