format

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2017 License: ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(w io.Writer, l Encoding) error

Encode encodes the Encoding to a writer.

Types

type Encoding

type Encoding interface {
	Encoding() uint64

	Message() []byte

	ToProtobuf() *serialize.Encoding
	// contains filtered or unexported methods
}

Encoding represents a msg or broadcast object payload.

func Decode

func Decode(r io.Reader) (Encoding, error)

Decode reads an Encoding type from a stream.

func Read

func Read(encoding uint64, msg []byte) (Encoding, error)

Read takes an encoding format code and an object payload and returns it as an Encoding object.

type Encoding1

type Encoding1 struct {
	Body string
}

Encoding1 implements the Bitmessage interface and represents a MsgMsg or MsgBroadcast with encoding type 1.

func (*Encoding1) Encoding

func (l *Encoding1) Encoding() uint64

Encoding returns the encoding format of the bitmessage.

func (*Encoding1) Message

func (l *Encoding1) Message() []byte

Message returns the raw form of the object payload.

func (*Encoding1) ToProtobuf

func (l *Encoding1) ToProtobuf() *serialize.Encoding

ToProtobuf encodes the message in a protobuf format.

type Encoding2

type Encoding2 struct {
	Subject string
	Body    string
}

Encoding2 implements the Bitmessage interface and represents a MsgMsg or MsgBroadcast with encoding type 2. It also implements the

func (*Encoding2) Encoding

func (l *Encoding2) Encoding() uint64

Encoding returns the encoding format of the bitmessage.

func (*Encoding2) Message

func (l *Encoding2) Message() []byte

Message returns the raw form of the object payload.

func (*Encoding2) ToProtobuf

func (l *Encoding2) ToProtobuf() *serialize.Encoding

ToProtobuf encodes the message in a protobuf format.

Directories

Path Synopsis
Package serialize is a generated protocol buffer package.
Package serialize is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL