Documentation ¶
Index ¶
- Constants
- func AssertMarker(r io.Reader, checkMarker bool, m byte) error
- func Dump(label string, val interface{}) error
- func DumpBytes(label string, buf []byte, size int)
- func Error(f string, v ...interface{}) error
- func MetaDataReform(p []byte, flag uint8) ([]byte, error)
- func ReadByte(r io.Reader) (byte, error)
- func ReadBytes(r io.Reader, n int) ([]byte, error)
- func ReadMarker(r io.Reader) (byte, error)
- func WriteByte(w io.Writer, b byte) (err error)
- func WriteBytes(w io.Writer, bytes []byte) (int, error)
- func WriteMarker(w io.Writer, m byte) error
- type Array
- type Decoder
- func (d *Decoder) Decode(r io.Reader, ver Version) (interface{}, error)
- func (d *Decoder) DecodeAmf0(r io.Reader) (interface{}, error)
- func (d *Decoder) DecodeAmf0Boolean(r io.Reader, decodeMarker bool) (result bool, err error)
- func (d *Decoder) DecodeAmf0Date(r io.Reader, decodeMarker bool) (result float64, err error)
- func (d *Decoder) DecodeAmf0EcmaArray(r io.Reader, decodeMarker bool) (Object, error)
- func (d *Decoder) DecodeAmf0LongString(r io.Reader, decodeMarker bool) (result string, err error)
- func (d *Decoder) DecodeAmf0Null(r io.Reader, decodeMarker bool) (result interface{}, err error)
- func (d *Decoder) DecodeAmf0Number(r io.Reader, decodeMarker bool) (result float64, err error)
- func (d *Decoder) DecodeAmf0Object(r io.Reader, decodeMarker bool) (Object, error)
- func (d *Decoder) DecodeAmf0StrictArray(r io.Reader, decodeMarker bool) (result Array, err error)
- func (d *Decoder) DecodeAmf0String(r io.Reader, decodeMarker bool) (result string, err error)
- func (d *Decoder) DecodeAmf0TypedObject(r io.Reader, decodeMarker bool) (TypedObject, error)
- func (d *Decoder) DecodeAmf0Undefined(r io.Reader, decodeMarker bool) (result interface{}, err error)
- func (d *Decoder) DecodeAmf0Unsupported(r io.Reader, decodeMarker bool) (result interface{}, err error)
- func (d *Decoder) DecodeAmf0XmlDocument(r io.Reader, decodeMarker bool) (result string, err error)
- func (d *Decoder) DecodeAmf3(r io.Reader) (interface{}, error)
- func (d *Decoder) DecodeAmf3Array(r io.Reader, decodeMarker bool) (result Array, err error)
- func (d *Decoder) DecodeAmf3ByteArray(r io.Reader, decodeMarker bool) (result []byte, err error)
- func (d *Decoder) DecodeAmf3Date(r io.Reader, decodeMarker bool) (result time.Time, err error)
- func (d *Decoder) DecodeAmf3Double(r io.Reader, decodeMarker bool) (result float64, err error)
- func (d *Decoder) DecodeAmf3False(r io.Reader, decodeMarker bool) (result bool, err error)
- func (d *Decoder) DecodeAmf3Integer(r io.Reader, decodeMarker bool) (result int32, err error)
- func (d *Decoder) DecodeAmf3Null(r io.Reader, decodeMarker bool) (result interface{}, err error)
- func (d *Decoder) DecodeAmf3Object(r io.Reader, decodeMarker bool) (result interface{}, err error)
- func (d *Decoder) DecodeAmf3String(r io.Reader, decodeMarker bool) (result string, err error)
- func (d *Decoder) DecodeAmf3True(r io.Reader, decodeMarker bool) (result bool, err error)
- func (d *Decoder) DecodeAmf3Undefined(r io.Reader, decodeMarker bool) (result interface{}, err error)
- func (d *Decoder) DecodeAmf3Xml(r io.Reader, decodeMarker bool) (result string, err error)
- func (d *Decoder) DecodeBatch(r io.Reader, ver Version) (ret []interface{}, err error)
- func (d *Decoder) RegisterExternalHandler(name string, f ExternalHandler)
- type Encoder
- func (e *Encoder) Encode(w io.Writer, val interface{}, ver Version) (int, error)
- func (e *Encoder) EncodeAmf0(w io.Writer, val interface{}) (int, error)
- func (e *Encoder) EncodeAmf0Amf3Marker(w io.Writer) error
- func (e *Encoder) EncodeAmf0Boolean(w io.Writer, val bool, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0EcmaArray(w io.Writer, val Object, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0LongString(w io.Writer, val string, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0Null(w io.Writer, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0Number(w io.Writer, val float64, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0Object(w io.Writer, val Object, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0StrictArray(w io.Writer, val Array, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0String(w io.Writer, val string, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0Undefined(w io.Writer, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf0Unsupported(w io.Writer, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3(w io.Writer, val interface{}) (int, error)
- func (e *Encoder) EncodeAmf3Array(w io.Writer, val Array, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3ByteArray(w io.Writer, val []byte, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3Date(w io.Writer, val time.Time, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3Double(w io.Writer, val float64, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3False(w io.Writer, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3Integer(w io.Writer, val uint32, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3Null(w io.Writer, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3Object(w io.Writer, val TypedObject, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3String(w io.Writer, val string, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3True(w io.Writer, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeAmf3Undefined(w io.Writer, encodeMarker bool) (n int, err error)
- func (e *Encoder) EncodeBatch(w io.Writer, ver Version, val ...interface{}) (int, error)
- type ExternalHandler
- type Object
- type Trait
- type TypedObject
- type Version
Constants ¶
const ( AMF0 = 0x00 AMF3 = 0x03 )
const ( AMF0_NUMBER_MARKER = 0x00 AMF0_BOOLEAN_MARKER = 0x01 AMF0_STRING_MARKER = 0x02 AMF0_OBJECT_MARKER = 0x03 AMF0_MOVIECLIP_MARKER = 0x04 AMF0_NULL_MARKER = 0x05 AMF0_UNDEFINED_MARKER = 0x06 AMF0_REFERENCE_MARKER = 0x07 AMF0_ECMA_ARRAY_MARKER = 0x08 AMF0_OBJECT_END_MARKER = 0x09 AMF0_STRICT_ARRAY_MARKER = 0x0a AMF0_DATE_MARKER = 0x0b AMF0_LONG_STRING_MARKER = 0x0c AMF0_UNSUPPORTED_MARKER = 0x0d AMF0_RECORDSET_MARKER = 0x0e AMF0_XML_DOCUMENT_MARKER = 0x0f AMF0_TYPED_OBJECT_MARKER = 0x10 AMF0_ACMPLUS_OBJECT_MARKER = 0x11 )
const ( AMF0_BOOLEAN_FALSE = 0x00 AMF0_BOOLEAN_TRUE = 0x01 AMF0_STRING_MAX = 65535 AMF3_INTEGER_MAX = 536870911 )
const ( AMF3_UNDEFINED_MARKER = 0x00 AMF3_NULL_MARKER = 0x01 AMF3_FALSE_MARKER = 0x02 AMF3_TRUE_MARKER = 0x03 AMF3_INTEGER_MARKER = 0x04 AMF3_DOUBLE_MARKER = 0x05 AMF3_STRING_MARKER = 0x06 AMF3_XMLDOC_MARKER = 0x07 AMF3_DATE_MARKER = 0x08 AMF3_ARRAY_MARKER = 0x09 AMF3_OBJECT_MARKER = 0x0a AMF3_XMLSTRING_MARKER = 0x0b AMF3_BYTEARRAY_MARKER = 0x0c )
const ( ADD = 0x0 DEL = 0x3 )
const ( SetDataFrame string = "@setDataFrame" OnMetaData string = "onMetaData" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func NewDecoder() *Decoder
func (*Decoder) DecodeAmf0 ¶
amf0 polymorphic router
func (*Decoder) DecodeAmf0Boolean ¶
marker: 1 byte 0x01 format: 1 byte, 0x00 = false, 0x01 = true
func (*Decoder) DecodeAmf0Date ¶
marker: 1 byte 0x0b format: - normal number format:
- 8 byte big endian float64
- 2 byte unused
func (*Decoder) DecodeAmf0EcmaArray ¶
marker: 1 byte 0x08 format: - 4 byte big endian uint32 with length of associative array - normal object format:
- loop encoded string followed by encoded value
- terminated with empty string followed by 1 byte 0x09
func (*Decoder) DecodeAmf0LongString ¶
marker: 1 byte 0x0c format: - 4 byte big endian uint32 header to determine size - n (size) byte utf8 string
func (*Decoder) DecodeAmf0Null ¶
marker: 1 byte 0x05 no additional data
func (*Decoder) DecodeAmf0Number ¶
marker: 1 byte 0x00 format: 8 byte big endian float64
func (*Decoder) DecodeAmf0Object ¶
marker: 1 byte 0x03 format: - loop encoded string followed by encoded value - terminated with empty string followed by 1 byte 0x09
func (*Decoder) DecodeAmf0StrictArray ¶
marker: 1 byte 0x0a format: - 4 byte big endian uint32 to determine length of associative array - n (length) encoded values
func (*Decoder) DecodeAmf0String ¶
marker: 1 byte 0x02 format: - 2 byte big endian uint16 header to determine size - n (size) byte utf8 string
func (*Decoder) DecodeAmf0TypedObject ¶
marker: 1 byte 0x10 format: - normal string format:
- 2 byte big endian uint16 header to determine size
- n (size) byte utf8 string
- normal object format:
- loop encoded string followed by encoded value
- terminated with empty string followed by 1 byte 0x09
func (*Decoder) DecodeAmf0Undefined ¶
func (d *Decoder) DecodeAmf0Undefined(r io.Reader, decodeMarker bool) (result interface{}, err error)
marker: 1 byte 0x06 no additional data
func (*Decoder) DecodeAmf0Unsupported ¶
func (d *Decoder) DecodeAmf0Unsupported(r io.Reader, decodeMarker bool) (result interface{}, err error)
marker: 1 byte 0x0d no additional data
func (*Decoder) DecodeAmf0XmlDocument ¶
marker: 1 byte 0x0f format: - normal long string format
- 4 byte big endian uint32 header to determine size
- n (size) byte utf8 string
func (*Decoder) DecodeAmf3 ¶
amf3 polymorphic router
func (*Decoder) DecodeAmf3Array ¶
marker: 1 byte 0x09 format: - u29 reference int. if reference, no more data. - string representing associative array if present - n values (length of u29)
func (*Decoder) DecodeAmf3ByteArray ¶
marker: 1 byte 0x0c format:
- u29 reference int. if reference, no more data. if not reference, length value of bytes to read.
func (*Decoder) DecodeAmf3Date ¶
marker: 1 byte 0x08 format: - u29 reference int, if reference, no more data - timestamp double
func (*Decoder) DecodeAmf3Double ¶
marker: 1 byte 0x05
func (*Decoder) DecodeAmf3False ¶
marker: 1 byte 0x02 no additional data
func (*Decoder) DecodeAmf3Integer ¶
marker: 1 byte 0x04
func (*Decoder) DecodeAmf3Null ¶
marker: 1 byte 0x01 no additional data
func (*Decoder) DecodeAmf3Object ¶
marker: 1 byte 0x09 format: oh dear god
func (*Decoder) DecodeAmf3String ¶
marker: 1 byte 0x06 format:
- u29 reference int. if reference, no more data. if not reference, length value of bytes to read to complete string.
func (*Decoder) DecodeAmf3True ¶
marker: 1 byte 0x03 no additional data
func (*Decoder) DecodeAmf3Undefined ¶
func (d *Decoder) DecodeAmf3Undefined(r io.Reader, decodeMarker bool) (result interface{}, err error)
marker: 1 byte 0x00 no additional data
func (*Decoder) DecodeAmf3Xml ¶
marker: 1 byte 0x07 or 0x0b format:
- u29 reference int. if reference, no more data. if not reference, length value of bytes to read to complete string.
func (*Decoder) DecodeBatch ¶
func (*Decoder) RegisterExternalHandler ¶
func (d *Decoder) RegisterExternalHandler(name string, f ExternalHandler)
type Encoder ¶
type Encoder struct { }
func (*Encoder) EncodeAmf0 ¶
amf0 polymorphic router
func (*Encoder) EncodeAmf0Amf3Marker ¶
marker: 1 byte 0x11
func (*Encoder) EncodeAmf0Boolean ¶
marker: 1 byte 0x01 format: 1 byte, 0x00 = false, 0x01 = true
func (*Encoder) EncodeAmf0EcmaArray ¶
func (e *Encoder) EncodeAmf0EcmaArray(w io.Writer, val Object, encodeMarker bool) (n int, err error)
marker: 1 byte 0x08 format: - 4 byte big endian uint32 with length of associative array - normal object format:
- loop encoded string followed by encoded value
- terminated with empty string followed by 1 byte 0x09
func (*Encoder) EncodeAmf0LongString ¶
func (e *Encoder) EncodeAmf0LongString(w io.Writer, val string, encodeMarker bool) (n int, err error)
marker: 1 byte 0x0c format: - 4 byte big endian uint32 header to determine size - n (size) byte utf8 string
func (*Encoder) EncodeAmf0Null ¶
marker: 1 byte 0x05 no additional data
func (*Encoder) EncodeAmf0Number ¶
marker: 1 byte 0x00 format: 8 byte big endian float64
func (*Encoder) EncodeAmf0Object ¶
marker: 1 byte 0x03 format: - loop encoded string followed by encoded value - terminated with empty string followed by 1 byte 0x09
func (*Encoder) EncodeAmf0StrictArray ¶
func (e *Encoder) EncodeAmf0StrictArray(w io.Writer, val Array, encodeMarker bool) (n int, err error)
marker: 1 byte 0x0a format: - 4 byte big endian uint32 to determine length of associative array - n (length) encoded values
func (*Encoder) EncodeAmf0String ¶
marker: 1 byte 0x02 format: - 2 byte big endian uint16 header to determine size - n (size) byte utf8 string
func (*Encoder) EncodeAmf0Undefined ¶
marker: 1 byte 0x06 no additional data
func (*Encoder) EncodeAmf0Unsupported ¶
marker: 1 byte 0x0d no additional data
func (*Encoder) EncodeAmf3 ¶
func (*Encoder) EncodeAmf3Array ¶
marker: 1 byte 0x09 format: - u29 reference int. if reference, no more data. - string representing associative array if present - n values (length of u29)
func (*Encoder) EncodeAmf3ByteArray ¶
func (e *Encoder) EncodeAmf3ByteArray(w io.Writer, val []byte, encodeMarker bool) (n int, err error)
marker: 1 byte 0x0c format:
- u29 reference int. if reference, no more data. if not reference, length value of bytes to read .
func (*Encoder) EncodeAmf3Date ¶
marker: 1 byte 0x08 format: - u29 reference int, if reference, no more data - timestamp double
func (*Encoder) EncodeAmf3Double ¶
marker: 1 byte 0x05
func (*Encoder) EncodeAmf3False ¶
marker: 1 byte 0x02 no additional data
func (*Encoder) EncodeAmf3Integer ¶
marker: 1 byte 0x04
func (*Encoder) EncodeAmf3Null ¶
marker: 1 byte 0x01 no additional data
func (*Encoder) EncodeAmf3Object ¶
func (e *Encoder) EncodeAmf3Object(w io.Writer, val TypedObject, encodeMarker bool) (n int, err error)
marker: 1 byte 0x0a format: ugh
func (*Encoder) EncodeAmf3String ¶
marker: 1 byte 0x06 format:
- u29 reference int. if reference, no more data. if not reference, length value of bytes to read to complete string.
func (*Encoder) EncodeAmf3True ¶
marker: 1 byte 0x03 no additional data
func (*Encoder) EncodeAmf3Undefined ¶
marker: 1 byte 0x00 no additional data
type TypedObject ¶
func NewTypedObject ¶
func NewTypedObject() *TypedObject