Documentation ¶
Overview ¶
Package data provides the ability to read and write the necessary data types from a decompressed Satisfactory save body.
Index ¶
- func AssertAllBufferRead(t *testing.T, d *Data)
- type Data
- func (d *Data) Bytes() []byte
- func (d *Data) DebugReadDataChunk(l int32) ([]byte, error)
- func (d *Data) Index() int64
- func (d *Data) Len() int64
- func (d *Data) Measure() func() int32
- func (d *Data) NextByteIsNull() error
- func (d *Data) Read(p []byte) (n int, err error)
- func (d *Data) ReadBool() (bool, error)
- func (d *Data) ReadByte() (byte, error)
- func (d *Data) ReadBytes(l int32) ([]byte, error)
- func (d *Data) ReadFloat32() (float32, error)
- func (d *Data) ReadFloat32Array(l int) ([]float32, error)
- func (d *Data) ReadFloat64() (float64, error)
- func (d *Data) ReadInt32() (int32, error)
- func (d *Data) ReadInt32Array(l int) ([]int32, error)
- func (d *Data) ReadInt64() (int64, error)
- func (d *Data) ReadInt8() (int8, error)
- func (d *Data) ReadString() (string, error)
- func (d *Data) SkipBytes(l int64) error
- func (d *Data) Write(p []byte) (int, error)
- func (d *Data) WriteBool(b bool) error
- func (d *Data) WriteByte(b byte) error
- func (d *Data) WriteBytes(b []byte) error
- func (d *Data) WriteFloat32(f float32) error
- func (d *Data) WriteFloat32Array(f []float32) error
- func (d *Data) WriteFloat64(f float64) error
- func (d *Data) WriteInt32(i int32) error
- func (d *Data) WriteInt32Array(i []int32) error
- func (d *Data) WriteInt64(i int64) error
- func (d *Data) WriteInt8(i int8) error
- func (d *Data) WriteLen(i int32, idx int64) error
- func (d *Data) WriteNoneProp() error
- func (d *Data) WriteNull() error
- func (d *Data) WriteNulls(len int32) error
- func (d *Data) WriteString(str string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertAllBufferRead ¶
Types ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
func NewFromBytes ¶
func (*Data) DebugReadDataChunk ¶
DebugReadDataChunk reads a data chunk and returns the bytes with the length of the chunk prepended.
Once reading has completed the index is wound back to the starting position before the read. Useful in some debugging scenarios.
func (*Data) Index ¶
Index returns the current position in Data that the next read or write will occur at.
func (*Data) Measure ¶
Measure returns a function that will return the difference between the index when measure was called and when the returned function was called.
func (*Data) NextByteIsNull ¶
NextByteIsNull will return an error if the next byte is not a null.
func (*Data) ReadFloat32 ¶
func (*Data) ReadFloat64 ¶
func (*Data) ReadString ¶
func (*Data) WriteBytes ¶
func (*Data) WriteFloat32 ¶
func (*Data) WriteFloat32Array ¶
func (*Data) WriteFloat64 ¶
func (*Data) WriteInt32 ¶
func (*Data) WriteInt32Array ¶
func (*Data) WriteInt64 ¶
func (*Data) WriteLen ¶
WriteLen writes the int32 at the specified index and then resets the Index of Data back to its original position.
Useful in situations where we don't know what the length of something will be until we have written it. We can write a placeholder length, write the data and then update the length.