rename Read / Write into Unmarshal / Marshal when needed

Read() / Write() are used to read / write from streams, while
Unmarshal() / Marshal() are used to decode / encode from / to bytes.
This commit is contained in:
aler9
2022-06-27 17:26:00 +02:00
parent e3c9f0c2e6
commit f3b0fc69b4
44 changed files with 569 additions and 559 deletions

View File

@@ -97,7 +97,7 @@ func (h *Header) read(rb *bufio.Reader) error {
return nil
}
func (h Header) writeSize() int {
func (h Header) marshalSize() int {
// sort headers by key
// in order to obtain deterministic results
keys := make([]string, len(h))
@@ -119,7 +119,7 @@ func (h Header) writeSize() int {
return n
}
func (h Header) writeTo(buf []byte) int {
func (h Header) marshalTo(buf []byte) int {
// sort headers by key
// in order to obtain deterministic results
keys := make([]string, len(h))
@@ -141,8 +141,8 @@ func (h Header) writeTo(buf []byte) int {
return pos
}
func (h Header) write() []byte {
buf := make([]byte, h.writeSize())
h.writeTo(buf)
func (h Header) marshal() []byte {
buf := make([]byte, h.marshalSize())
h.marshalTo(buf)
return buf
}