55 lines
794 B
Go
55 lines
794 B
Go
package srpc
|
|
|
|
import (
|
|
"io"
|
|
|
|
"gitea.olznet.de/OlzNet/ssob"
|
|
)
|
|
|
|
type IEncoder interface {
|
|
Encode(e interface{}) error
|
|
}
|
|
|
|
type IDecoder interface {
|
|
Decode(e interface{}) error
|
|
}
|
|
|
|
type IEncoderHandler interface {
|
|
NewEncoder(w io.Writer) IEncoder
|
|
}
|
|
|
|
type IDecoderHandler interface {
|
|
NewDecoder(r io.Reader) IDecoder
|
|
}
|
|
|
|
type IEncoderDecoder interface {
|
|
IEncoderHandler
|
|
IDecoderHandler
|
|
}
|
|
|
|
type Encoder struct {
|
|
}
|
|
|
|
func (e *Encoder) NewEncoder(w io.Writer) IEncoder {
|
|
return ssob.NewEncoder(w)
|
|
}
|
|
|
|
type Decoder struct {
|
|
}
|
|
|
|
func (d *Decoder) NewDecoder(r io.Reader) IDecoder {
|
|
return ssob.NewDecoder(r)
|
|
}
|
|
|
|
type EncoderDecoder struct {
|
|
IEncoderHandler
|
|
IDecoderHandler
|
|
}
|
|
|
|
func NewEncoderDecoder() IEncoderDecoder {
|
|
enc := new(Encoder)
|
|
dec := new(Decoder)
|
|
|
|
return &EncoderDecoder{enc, dec}
|
|
}
|