2012-11-25 15:07:05 +00:00
|
|
|
package coding
|
2012-11-24 11:33:34 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"code.google.com/p/goprotobuf/proto"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ProtocolBufferEncoder struct {
|
|
|
|
message proto.Message
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *ProtocolBufferEncoder) Encode() ([]byte, error) {
|
|
|
|
return proto.Marshal(p.message)
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewProtocolBufferEncoder(message proto.Message) *ProtocolBufferEncoder {
|
|
|
|
return &ProtocolBufferEncoder{
|
|
|
|
message: message,
|
|
|
|
}
|
|
|
|
}
|