Documentation ¶
Index ¶
- func IsBinaryFile(path string) bool
- func LoadSerializedBinary[X any](inputPath string) (*X, error)
- func Write[X Serializable](outputPath string, x X, perm os.FileMode) error
- func WriteSerializedBinary(value Serializable, target ioutil.OutputTarget) error
- type BinaryReader
- type BinaryWriter
- type Deserializable
- type Serializable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBinaryFile ¶
func LoadSerializedBinary ¶
func WriteSerializedBinary ¶
func WriteSerializedBinary(value Serializable, target ioutil.OutputTarget) error
Types ¶
type BinaryReader ¶
type BinaryReader struct {
// contains filtered or unexported fields
}
BinaryReader provides methods to decode content written by BinaryWriter.
func NewBinaryReader ¶
func NewBinaryReader(in io.Reader) *BinaryReader
func (*BinaryReader) ReadBool ¶
func (r *BinaryReader) ReadBool(target *bool) error
func (*BinaryReader) ReadBytes ¶
func (r *BinaryReader) ReadBytes(target *[]byte) error
func (*BinaryReader) ReadUInt ¶
func (r *BinaryReader) ReadUInt(target any) error
type BinaryWriter ¶
type BinaryWriter struct {
// contains filtered or unexported fields
}
BinaryWriter writes a simple binary format which can be read again using BinaryReader. The format is a simple concatenation of values, with prefixed length for variable length items. All numbers are encoded using big endian.
func NewBinaryWriter ¶
func NewBinaryWriter(out io.Writer) *BinaryWriter
func (*BinaryWriter) WriteBool ¶
func (w *BinaryWriter) WriteBool(v bool) error
func (*BinaryWriter) WriteBytes ¶
func (w *BinaryWriter) WriteBytes(v []byte) error
func (*BinaryWriter) WriteUInt ¶
func (w *BinaryWriter) WriteUInt(v any) error
type Deserializable ¶
type Deserializable interface { // Deserialize decodes raw bytes into the type. Deserialize(in io.Reader) error }
Deserializable defines functionality for a type that may be deserialized from raw bytes.
type Serializable ¶
type Serializable interface { // Serialize encodes the type as raw bytes. Serialize(out io.Writer) error }
Serializable defines functionality for a type that may be serialized to raw bytes.
Click to show internal directories.
Click to hide internal directories.