decoder

package
v0.0.0-...-05965fc Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016-2019 DutchSec (https://dutchsec.com/)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decode

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

func NewDecoder

func NewDecoder(data []byte) *Decode

func (*Decode) Available

func (d *Decode) Available() int

func (*Decode) Byte

func (d *Decode) Byte() byte

func (*Decode) Copy

func (d *Decode) Copy(size int) []byte

func (*Decode) Data

func (d *Decode) Data() string

func (*Decode) HasBytes

func (d *Decode) HasBytes(size int) error

func (*Decode) Int16

func (d *Decode) Int16() int16

func (*Decode) Int32

func (d *Decode) Int32() int32

func (*Decode) LastError

func (d *Decode) LastError() error

func (*Decode) PeekByte

func (d *Decode) PeekByte() byte

func (*Decode) PeekInt16

func (d *Decode) PeekInt16() int16

func (*Decode) Seek

func (d *Decode) Seek(pos int)

Seeking relative to current offset

func (*Decode) Uint32

func (d *Decode) Uint32() uint32

type Decoder

type Decoder interface {
	Available() int
	HasBytes(size int) error

	Byte() byte
	Int16() int16
	Int32() int32
	Uint32() uint32

	PeekByte() byte
	PeekInt16() int16

	Data() string
	Copy(size int) []byte
	Seek(pos int)

	LastError() error
}

type Encoder

type Encoder struct {
	bytes.Buffer
}

func NewEncoder

func NewEncoder() *Encoder

func (*Encoder) WriteData

func (e *Encoder) WriteData(v string, zero bool)

if zero is true, write zero length

func (*Encoder) WriteUint16

func (e *Encoder) WriteUint16(v int16)

func (*Encoder) WriteUint32

func (e *Encoder) WriteUint32(v int32)

func (*Encoder) WriteUint8

func (e *Encoder) WriteUint8(b byte)

type EncoderType

type EncoderType interface {
	WriteUint8(b byte)

	WriteUint16(v int16)
	WriteUint32(v int32)

	WriteData(v string, zero bool)
}

type ErrOutOfBounds

type ErrOutOfBounds struct {
	Min int
	Max int
	Got int
}

func (ErrOutOfBounds) Error

func (e ErrOutOfBounds) Error() string

Jump to

Keyboard shortcuts

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