data

package
v0.0.0-...-0c1458e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package data provides the ability to read and write the necessary data types from a decompressed Satisfactory save body.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertAllBufferRead

func AssertAllBufferRead(t *testing.T, d *Data)

Types

type Data

type Data struct {
	// contains filtered or unexported fields
}

func New

func New() *Data

func NewFromBytes

func NewFromBytes(b []byte) *Data

func NewFromReader

func NewFromReader(r io.Reader) (*Data, error)

func TestData

func TestData(t *testing.T, filePath string) *Data

func (*Data) Bytes

func (d *Data) Bytes() []byte

Bytes returns the underlying byte slice.

func (*Data) DebugReadDataChunk

func (d *Data) DebugReadDataChunk(l int32) ([]byte, error)

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

func (d *Data) Index() int64

Index returns the current position in Data that the next read or write will occur at.

func (*Data) Len

func (d *Data) Len() int64

Len returns the length of the underlying byte slice.

func (*Data) Measure

func (d *Data) Measure() func() int32

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

func (d *Data) NextByteIsNull() error

NextByteIsNull will return an error if the next byte is not a null.

func (*Data) Read

func (d *Data) Read(p []byte) (n int, err error)

func (*Data) ReadBool

func (d *Data) ReadBool() (bool, error)

func (*Data) ReadByte

func (d *Data) ReadByte() (byte, error)

func (*Data) ReadBytes

func (d *Data) ReadBytes(l int32) ([]byte, error)

func (*Data) ReadFloat32

func (d *Data) ReadFloat32() (float32, error)

func (*Data) ReadFloat32Array

func (d *Data) ReadFloat32Array(l int) ([]float32, error)

func (*Data) ReadFloat64

func (d *Data) ReadFloat64() (float64, error)

func (*Data) ReadInt32

func (d *Data) ReadInt32() (int32, error)

func (*Data) ReadInt32Array

func (d *Data) ReadInt32Array(l int) ([]int32, error)

func (*Data) ReadInt64

func (d *Data) ReadInt64() (int64, error)

func (*Data) ReadInt8

func (d *Data) ReadInt8() (int8, error)

func (*Data) ReadString

func (d *Data) ReadString() (string, error)

func (*Data) SkipBytes

func (d *Data) SkipBytes(l int64) error

func (*Data) Write

func (d *Data) Write(p []byte) (int, error)

func (*Data) WriteBool

func (d *Data) WriteBool(b bool) error

func (*Data) WriteByte

func (d *Data) WriteByte(b byte) error

func (*Data) WriteBytes

func (d *Data) WriteBytes(b []byte) error

func (*Data) WriteFloat32

func (d *Data) WriteFloat32(f float32) error

func (*Data) WriteFloat32Array

func (d *Data) WriteFloat32Array(f []float32) error

func (*Data) WriteFloat64

func (d *Data) WriteFloat64(f float64) error

func (*Data) WriteInt32

func (d *Data) WriteInt32(i int32) error

func (*Data) WriteInt32Array

func (d *Data) WriteInt32Array(i []int32) error

func (*Data) WriteInt64

func (d *Data) WriteInt64(i int64) error

func (*Data) WriteInt8

func (d *Data) WriteInt8(i int8) error

func (*Data) WriteLen

func (d *Data) WriteLen(i int32, idx int64) error

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.

func (*Data) WriteNoneProp

func (d *Data) WriteNoneProp() error

func (*Data) WriteNull

func (d *Data) WriteNull() error

func (*Data) WriteNulls

func (d *Data) WriteNulls(len int32) error

func (*Data) WriteString

func (d *Data) WriteString(str string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL