2016-08-26 12:51:09 +08:00
|
|
|
package bencode
|
|
|
|
|
|
|
|
type Bytes []byte
|
|
|
|
|
|
|
|
var (
|
|
|
|
_ Unmarshaler = &Bytes{}
|
|
|
|
_ Marshaler = &Bytes{}
|
2016-08-26 18:29:29 +08:00
|
|
|
_ Marshaler = Bytes{}
|
2016-08-26 12:51:09 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func (me *Bytes) UnmarshalBencode(b []byte) error {
|
|
|
|
*me = append([]byte(nil), b...)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2016-08-26 18:29:29 +08:00
|
|
|
func (me Bytes) MarshalBencode() ([]byte, error) {
|
|
|
|
return me, nil
|
2016-08-26 12:51:09 +08:00
|
|
|
}
|