nbt

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: GPL-3.0 Imports: 7 Imported by: 1

Documentation

Overview

package nbt is a library for working with Minecraft nbt files. encoding is not supported yet.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidUnmarshalType = errors.New("trying to unmarshal into wrong type")
)

Functions

func Marshal

func Marshal(v interface{}) ([]byte, error)

Marshal will encode v to an array of bytes, eventually returning an error.

func Unmarshal

func Unmarshal(b []byte, v interface{}) (err error)

Unmarshal decodes data from the byte array b into the interface v, eventually returning an error.

Types

type Decoder

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

Decoder decodes reading reading from an underlying io.Reader

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a Decoder with r as the underlying io.Reader

func (*Decoder) Decode

func (d *Decoder) Decode(v interface{}) (err error)

Decode decodes the data from the reader d.r into the interface v, eventually returning an error

type Encoder

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

Encoder handles nbt encoding.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns an Encoder which will write the result of the encoding to w.

func (*Encoder) Encode

func (e *Encoder) Encode(v interface{}) error

Encode will encode v to the writer w specified in the constructor.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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