github.com/daeuniverse/quic-go@v0.0.0-20240413031024-943f218e0810/internal/utils/byteorder.go (about)

     1  package utils
     2  
     3  import (
     4  	"bytes"
     5  	"io"
     6  )
     7  
     8  // A ByteOrder specifies how to convert byte sequences into 16-, 32-, or 64-bit unsigned integers.
     9  type ByteOrder interface {
    10  	Uint32([]byte) uint32
    11  	Uint24([]byte) uint32
    12  	Uint16([]byte) uint16
    13  
    14  	ReadUint32(io.ByteReader) (uint32, error)
    15  	ReadUint24(io.ByteReader) (uint32, error)
    16  	ReadUint16(io.ByteReader) (uint16, error)
    17  
    18  	WriteUint32(*bytes.Buffer, uint32)
    19  	WriteUint24(*bytes.Buffer, uint32)
    20  	WriteUint16(*bytes.Buffer, uint16)
    21  }