io: refactoring for using WriteVarBytes instead of WriteLE
goal is to be consistent with C# implementation. For writing []byte WriteBytes used and for byte - WriteVarByte.
This commit is contained in:
parent
d02673c112
commit
03ff2976ed
20 changed files with 33 additions and 34 deletions
|
@ -93,18 +93,18 @@ func (w *BinWriter) WriteVarUint(val uint64) {
|
|||
|
||||
}
|
||||
|
||||
// WriteVarBytes writes a variable byte into the underlying io.Writer without prefix.
|
||||
func (w *BinWriter) WriteVarBytes(b []byte) {
|
||||
// WriteBytes writes a variable byte into the underlying io.Writer without prefix.
|
||||
func (w *BinWriter) WriteBytes(b []byte) {
|
||||
w.WriteLE(b)
|
||||
}
|
||||
|
||||
// WriteBytes writes a variable length byte array into the underlying io.Writer.
|
||||
func (w *BinWriter) WriteBytes(b []byte) {
|
||||
// WriteVarBytes writes a variable length byte array into the underlying io.Writer.
|
||||
func (w *BinWriter) WriteVarBytes(b []byte) {
|
||||
w.WriteVarUint(uint64(len(b)))
|
||||
w.WriteLE(b)
|
||||
}
|
||||
|
||||
// WriteString writes a variable length string into the underlying io.Writer.
|
||||
func (w *BinWriter) WriteString(s string) {
|
||||
w.WriteBytes([]byte(s))
|
||||
w.WriteVarBytes([]byte(s))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue