16 lines
357 B
Go
16 lines
357 B
Go
package encoding
|
|
|
|
import "bytes"
|
|
|
|
type ASCIICoder struct{}
|
|
|
|
func (c *ASCIICoder) Encode(s *string, buf *bytes.Buffer) error {
|
|
// These should be ASCII but UTF8 is a superset of ASCII so hopefully this'll be fine
|
|
buf.WriteString(*s)
|
|
return nil
|
|
}
|
|
|
|
func (c *ASCIICoder) Decode(buf *bytes.Buffer) (string, error) {
|
|
return buf.String(), nil
|
|
}
|