Documentation
¶
Overview ¶
*
- MIT License *
- Copyright (c) 2017 - 2018 CNES *
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions: *
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software. *
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
*
- MIT License *
- Copyright (c) 2017 - 2019 CNES *
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions: *
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software. *
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
*
- MIT License *
- Copyright (c) 2017 - 2019 CNES *
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions: *
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software. *
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
*
- MIT License *
- Copyright (c) 2017 - 2018 CNES *
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions: *
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software. *
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
Index ¶
- Constants
- Variables
- func ReadUVarInt(buf []byte, offset *int) uint64
- func WriteUVarInt(value uint64, buf []byte) []byte
- type BinaryBuffer
- func (buffer *BinaryBuffer) Body() []byte
- func (buffer *BinaryBuffer) Read() (byte, error)
- func (buffer *BinaryBuffer) Read16() (uint16, error)
- func (buffer *BinaryBuffer) Read32() (uint32, error)
- func (buffer *BinaryBuffer) Read64() (uint64, error)
- func (buffer *BinaryBuffer) ReadBytes(buf []byte) error
- func (buffer *BinaryBuffer) ReadFlag() (bool, error)
- func (buffer *BinaryBuffer) ReadUVarInt() (uint64, error)
- func (buffer *BinaryBuffer) Remaining() []byte
- func (buffer *BinaryBuffer) Reset(write bool)
- func (buffer *BinaryBuffer) Write(value byte) error
- func (buffer *BinaryBuffer) Write16(value uint16) error
- func (buffer *BinaryBuffer) Write32(value uint32) error
- func (buffer *BinaryBuffer) Write64(value uint64) error
- func (buffer *BinaryBuffer) WriteBytes(value []byte) error
- func (buffer *BinaryBuffer) WriteFlag(value bool) error
- func (buffer *BinaryBuffer) WriteUVarInt(value uint64) error
- type BinaryDecoder
- func (decoder *BinaryDecoder) DecodeAttributeType() (Integer, error)
- func (decoder *BinaryDecoder) DecodeBlob() (*Blob, error)
- func (decoder *BinaryDecoder) DecodeBoolean() (*Boolean, error)
- func (decoder *BinaryDecoder) DecodeDouble() (*Double, error)
- func (decoder *BinaryDecoder) DecodeDuration() (*Duration, error)
- func (decoder *BinaryDecoder) DecodeFineTime() (*FineTime, error)
- func (decoder *BinaryDecoder) DecodeFloat() (*Float, error)
- func (decoder *BinaryDecoder) DecodeIdentifier() (*Identifier, error)
- func (decoder *BinaryDecoder) DecodeInteger() (*Integer, error)
- func (decoder *BinaryDecoder) DecodeLong() (*Long, error)
- func (decoder *BinaryDecoder) DecodeMediumEnum() (uint16, error)
- func (decoder *BinaryDecoder) DecodeOctet() (*Octet, error)
- func (decoder *BinaryDecoder) DecodeShort() (*Short, error)
- func (decoder *BinaryDecoder) DecodeSmallEnum() (uint8, error)
- func (decoder *BinaryDecoder) DecodeString() (*String, error)
- func (decoder *BinaryDecoder) DecodeTime() (*Time, error)
- func (decoder *BinaryDecoder) DecodeUInteger() (*UInteger, error)
- func (decoder *BinaryDecoder) DecodeULong() (*ULong, error)
- func (decoder *BinaryDecoder) DecodeUOctet() (*UOctet, error)
- func (decoder *BinaryDecoder) DecodeURI() (*URI, error)
- func (decoder *BinaryDecoder) DecodeUShort() (*UShort, error)
- func (decoder *BinaryDecoder) DecodelargeEnum() (uint32, error)
- func (decoder *BinaryDecoder) IsNull() (bool, error)
- func (decoder *BinaryDecoder) Read() (byte, error)
- func (decoder *BinaryDecoder) ReadUInt32() (uint32, error)
- func (decoder *BinaryDecoder) Remaining() []byte
- type BinaryEncoder
- func (encoder *BinaryEncoder) Body() []byte
- func (encoder *BinaryEncoder) EncodeAttributeType(typeval Integer) error
- func (encoder *BinaryEncoder) EncodeBlob(blob *Blob) error
- func (encoder *BinaryEncoder) EncodeBoolean(att *Boolean) error
- func (encoder *BinaryEncoder) EncodeDouble(att *Double) error
- func (encoder *BinaryEncoder) EncodeDuration(att *Duration) error
- func (encoder *BinaryEncoder) EncodeFineTime(t *FineTime) error
- func (encoder *BinaryEncoder) EncodeFloat(att *Float) error
- func (encoder *BinaryEncoder) EncodeIdentifier(id *Identifier) error
- func (encoder *BinaryEncoder) EncodeInteger(att *Integer) error
- func (encoder *BinaryEncoder) EncodeLong(att *Long) error
- func (encoder *BinaryEncoder) EncodeMediumEnum(ordinal uint16) error
- func (encoder *BinaryEncoder) EncodeNotNull() error
- func (encoder *BinaryEncoder) EncodeNull() error
- func (encoder *BinaryEncoder) EncodeOctet(att *Octet) error
- func (encoder *BinaryEncoder) EncodeShort(att *Short) error
- func (encoder *BinaryEncoder) EncodeSmallEnum(ordinal uint8) error
- func (encoder *BinaryEncoder) EncodeString(str *String) error
- func (encoder *BinaryEncoder) EncodeTime(t *Time) error
- func (encoder *BinaryEncoder) EncodeUInteger(att *UInteger) error
- func (encoder *BinaryEncoder) EncodeULong(att *ULong) error
- func (encoder *BinaryEncoder) EncodeUOctet(att *UOctet) error
- func (encoder *BinaryEncoder) EncodeURI(uri *URI) error
- func (encoder *BinaryEncoder) EncodeUShort(att *UShort) error
- func (encoder *BinaryEncoder) EncodelargeEnum(ordinal uint32) error
- func (encoder *BinaryEncoder) Write(b byte) error
- func (encoder *BinaryEncoder) WriteBody(buf []byte) error
- func (encoder *BinaryEncoder) WriteUInt32(i uint32) error
- type FixedBinaryEncoding
- type VarintBinaryEncoding
Constants ¶
const ( TRUE byte = 1 FALSE byte = 0 )
Variables ¶
var ( FixedBinaryEncodingFactory *FixedBinaryEncoding = nil VarintBinaryEncodingFactory *VarintBinaryEncoding = nil )
Functions ¶
func ReadUVarInt ¶
func WriteUVarInt ¶
Types ¶
type BinaryBuffer ¶
func (*BinaryBuffer) Body ¶
func (buffer *BinaryBuffer) Body() []byte
Returns the slice containing all encoded datas.
func (*BinaryBuffer) Read ¶
func (buffer *BinaryBuffer) Read() (byte, error)
func (*BinaryBuffer) Read16 ¶
func (buffer *BinaryBuffer) Read16() (uint16, error)
func (*BinaryBuffer) Read32 ¶
func (buffer *BinaryBuffer) Read32() (uint32, error)
func (*BinaryBuffer) Read64 ¶
func (buffer *BinaryBuffer) Read64() (uint64, error)
func (*BinaryBuffer) ReadBytes ¶
func (buffer *BinaryBuffer) ReadBytes(buf []byte) error
func (*BinaryBuffer) ReadFlag ¶
func (buffer *BinaryBuffer) ReadFlag() (bool, error)
func (*BinaryBuffer) ReadUVarInt ¶
func (buffer *BinaryBuffer) ReadUVarInt() (uint64, error)
Reads an unsigned varint as defined in 5.25 section of the specification.
func (*BinaryBuffer) Remaining ¶
func (buffer *BinaryBuffer) Remaining() []byte
Returns the part of buffer that still needs to be decoded
func (*BinaryBuffer) Reset ¶
func (buffer *BinaryBuffer) Reset(write bool)
Reset the buffer allowing to reuse it. If write parameter is true the internal slice is cleaned and the buffer can be write anew.
func (*BinaryBuffer) Write ¶
func (buffer *BinaryBuffer) Write(value byte) error
func (*BinaryBuffer) Write16 ¶
func (buffer *BinaryBuffer) Write16(value uint16) error
func (*BinaryBuffer) Write32 ¶
func (buffer *BinaryBuffer) Write32(value uint32) error
func (*BinaryBuffer) Write64 ¶
func (buffer *BinaryBuffer) Write64(value uint64) error
func (*BinaryBuffer) WriteBytes ¶
func (buffer *BinaryBuffer) WriteBytes(value []byte) error
func (*BinaryBuffer) WriteFlag ¶
func (buffer *BinaryBuffer) WriteFlag(value bool) error
func (*BinaryBuffer) WriteUVarInt ¶
func (buffer *BinaryBuffer) WriteUVarInt(value uint64) error
Writes an unsigned varint as defined in 5.25 section of the specification.
type BinaryDecoder ¶
type BinaryDecoder struct { GenDecoder Varint bool In Buffer }
func NewBinaryDecoder ¶
func NewBinaryDecoder(buf []byte, varint bool) *BinaryDecoder
Creates a new decoder using a slice containing binary data to decode.
func (*BinaryDecoder) DecodeAttributeType ¶
func (decoder *BinaryDecoder) DecodeAttributeType() (Integer, error)
Decodes the short form of an attribute. @return The short form of the attribute.
func (*BinaryDecoder) DecodeBlob ¶
func (decoder *BinaryDecoder) DecodeBlob() (*Blob, error)
Decodes a Blob. @return The decoded Blob.
func (*BinaryDecoder) DecodeBoolean ¶
func (decoder *BinaryDecoder) DecodeBoolean() (*Boolean, error)
Decodes a Boolean. @return The decoded Boolean.
func (*BinaryDecoder) DecodeDouble ¶
func (decoder *BinaryDecoder) DecodeDouble() (*Double, error)
Decodes a Double. @return The decoded Double.
func (*BinaryDecoder) DecodeDuration ¶
func (decoder *BinaryDecoder) DecodeDuration() (*Duration, error)
Decodes a Duration. @return The decoded Duration.
func (*BinaryDecoder) DecodeFineTime ¶
func (decoder *BinaryDecoder) DecodeFineTime() (*FineTime, error)
Decodes a FineTime. @return The decoded FineTime.
func (*BinaryDecoder) DecodeFloat ¶
func (decoder *BinaryDecoder) DecodeFloat() (*Float, error)
Decodes a Float. @return The decoded Float.
func (*BinaryDecoder) DecodeIdentifier ¶
func (decoder *BinaryDecoder) DecodeIdentifier() (*Identifier, error)
Decodes an Identifier. @return The decoded Identifier.
func (*BinaryDecoder) DecodeInteger ¶
func (decoder *BinaryDecoder) DecodeInteger() (*Integer, error)
Decodes an Integer. @return The decoded Integer.
func (*BinaryDecoder) DecodeLong ¶
func (decoder *BinaryDecoder) DecodeLong() (*Long, error)
Decodes a Long. @return The decoded Long.
func (*BinaryDecoder) DecodeMediumEnum ¶
func (decoder *BinaryDecoder) DecodeMediumEnum() (uint16, error)
func (*BinaryDecoder) DecodeOctet ¶
func (decoder *BinaryDecoder) DecodeOctet() (*Octet, error)
Decodes an Octet. @return The decoded Octet.
func (*BinaryDecoder) DecodeShort ¶
func (decoder *BinaryDecoder) DecodeShort() (*Short, error)
Decodes a Short. @return The decoded Short.
func (*BinaryDecoder) DecodeSmallEnum ¶
func (decoder *BinaryDecoder) DecodeSmallEnum() (uint8, error)
func (*BinaryDecoder) DecodeString ¶
func (decoder *BinaryDecoder) DecodeString() (*String, error)
Decodes a String. @return The decoded String.
func (*BinaryDecoder) DecodeTime ¶
func (decoder *BinaryDecoder) DecodeTime() (*Time, error)
Decodes a Time. @return The decoded Time.
func (*BinaryDecoder) DecodeUInteger ¶
func (decoder *BinaryDecoder) DecodeUInteger() (*UInteger, error)
Decodes a UInteger. @return The decoded UInteger.
func (*BinaryDecoder) DecodeULong ¶
func (decoder *BinaryDecoder) DecodeULong() (*ULong, error)
Decodes a ULong. @return The decoded ULong.
func (*BinaryDecoder) DecodeUOctet ¶
func (decoder *BinaryDecoder) DecodeUOctet() (*UOctet, error)
Decodes a UOctet. @return The decoded UOctet.
func (*BinaryDecoder) DecodeURI ¶
func (decoder *BinaryDecoder) DecodeURI() (*URI, error)
Decodes a URI. @return The decoded URI.
func (*BinaryDecoder) DecodeUShort ¶
func (decoder *BinaryDecoder) DecodeUShort() (*UShort, error)
Decodes a UShort. @return The decoded UShort.
func (*BinaryDecoder) DecodelargeEnum ¶
func (decoder *BinaryDecoder) DecodelargeEnum() (uint32, error)
func (*BinaryDecoder) IsNull ¶
func (decoder *BinaryDecoder) IsNull() (bool, error)
func (*BinaryDecoder) Read ¶
func (decoder *BinaryDecoder) Read() (byte, error)
func (*BinaryDecoder) ReadUInt32 ¶
func (decoder *BinaryDecoder) ReadUInt32() (uint32, error)
func (*BinaryDecoder) Remaining ¶
func (decoder *BinaryDecoder) Remaining() []byte
Returns the part of buffer that still needs to be decoded
type BinaryEncoder ¶
type BinaryEncoder struct { GenEncoder Varint bool Out Buffer }
func NewBinaryEncoder ¶
func NewBinaryEncoder(buf []byte, varint bool) *BinaryEncoder
Creates a new encoder using a slice with sufficient capacity to encode datas. If the slice is not empty the encoded datas are append afterwards.
func (*BinaryEncoder) Body ¶
func (encoder *BinaryEncoder) Body() []byte
Returns a new slice containing all encoded data as needed to be sent. The buffer can be used anew without side-effect on this slice, the internal slice can be get using encoder.Out.(*binary.BinaryBuffer).Buf
func (*BinaryEncoder) EncodeAttributeType ¶
func (encoder *BinaryEncoder) EncodeAttributeType(typeval Integer) error
Encodes the short form of an attribute.
func (*BinaryEncoder) EncodeBlob ¶
func (encoder *BinaryEncoder) EncodeBlob(blob *Blob) error
Encodes a non-null Blob. @param att The Blob to encode.
func (*BinaryEncoder) EncodeBoolean ¶
func (encoder *BinaryEncoder) EncodeBoolean(att *Boolean) error
Encodes a non-null Boolean. @param att The Boolean to encode.
func (*BinaryEncoder) EncodeDouble ¶
func (encoder *BinaryEncoder) EncodeDouble(att *Double) error
Encodes a non-null Double. @param att The Double to encode.
func (*BinaryEncoder) EncodeDuration ¶
func (encoder *BinaryEncoder) EncodeDuration(att *Duration) error
Encodes a non-null Duration. @param att The Duration to encode.
func (*BinaryEncoder) EncodeFineTime ¶
func (encoder *BinaryEncoder) EncodeFineTime(t *FineTime) error
Encodes a non-null FineTime. @param att The FineTime to encode.
func (*BinaryEncoder) EncodeFloat ¶
func (encoder *BinaryEncoder) EncodeFloat(att *Float) error
Encodes a non-null Float. @param att The Float to encode.
func (*BinaryEncoder) EncodeIdentifier ¶
func (encoder *BinaryEncoder) EncodeIdentifier(id *Identifier) error
Encodes a non-null Identifier. @param att The Identifier to encode.
func (*BinaryEncoder) EncodeInteger ¶
func (encoder *BinaryEncoder) EncodeInteger(att *Integer) error
Encodes a non-null Integer. @param att The Integer to encode.
func (*BinaryEncoder) EncodeLong ¶
func (encoder *BinaryEncoder) EncodeLong(att *Long) error
Encodes a non-null Long. @param att The Long to encode.
func (*BinaryEncoder) EncodeMediumEnum ¶
func (encoder *BinaryEncoder) EncodeMediumEnum(ordinal uint16) error
func (*BinaryEncoder) EncodeNotNull ¶
func (encoder *BinaryEncoder) EncodeNotNull() error
func (*BinaryEncoder) EncodeNull ¶
func (encoder *BinaryEncoder) EncodeNull() error
func (*BinaryEncoder) EncodeOctet ¶
func (encoder *BinaryEncoder) EncodeOctet(att *Octet) error
Encodes a non-null Octet. @param att The Octet to encode.
func (*BinaryEncoder) EncodeShort ¶
func (encoder *BinaryEncoder) EncodeShort(att *Short) error
Encodes a non-null Short. @param att The Short to encode.
func (*BinaryEncoder) EncodeSmallEnum ¶
func (encoder *BinaryEncoder) EncodeSmallEnum(ordinal uint8) error
func (*BinaryEncoder) EncodeString ¶
func (encoder *BinaryEncoder) EncodeString(str *String) error
Encodes a non-null String. @param att The String to encode.
func (*BinaryEncoder) EncodeTime ¶
func (encoder *BinaryEncoder) EncodeTime(t *Time) error
Encodes a non-null Time. @param att The Time to encode.
func (*BinaryEncoder) EncodeUInteger ¶
func (encoder *BinaryEncoder) EncodeUInteger(att *UInteger) error
Encodes a non-null UInteger. @param att The UInteger to encode.
func (*BinaryEncoder) EncodeULong ¶
func (encoder *BinaryEncoder) EncodeULong(att *ULong) error
Encodes a non-null ULong. @param att The ULong to encode.
func (*BinaryEncoder) EncodeUOctet ¶
func (encoder *BinaryEncoder) EncodeUOctet(att *UOctet) error
Encodes a non-null UOctet. @param att The UOctet to encode.
func (*BinaryEncoder) EncodeURI ¶
func (encoder *BinaryEncoder) EncodeURI(uri *URI) error
Encodes a non-null URI. @param att The URI to encode. @throws IllegalArgumentException If the argument is null.
func (*BinaryEncoder) EncodeUShort ¶
func (encoder *BinaryEncoder) EncodeUShort(att *UShort) error
Encodes a non-null UShort. @param att The UShort to encode.
func (*BinaryEncoder) EncodelargeEnum ¶
func (encoder *BinaryEncoder) EncodelargeEnum(ordinal uint32) error
func (*BinaryEncoder) Write ¶
func (encoder *BinaryEncoder) Write(b byte) error
func (*BinaryEncoder) WriteBody ¶
func (encoder *BinaryEncoder) WriteBody(buf []byte) error
func (*BinaryEncoder) WriteUInt32 ¶
func (encoder *BinaryEncoder) WriteUInt32(i uint32) error
type FixedBinaryEncoding ¶
type FixedBinaryEncoding struct{}
func (*FixedBinaryEncoding) NewDecoder ¶
func (*FixedBinaryEncoding) NewDecoder(buf []byte) Decoder
func (*FixedBinaryEncoding) NewEncoder ¶
func (*FixedBinaryEncoding) NewEncoder(buf []byte) Encoder
type VarintBinaryEncoding ¶
type VarintBinaryEncoding struct{}
func (*VarintBinaryEncoding) NewDecoder ¶
func (*VarintBinaryEncoding) NewDecoder(buf []byte) Decoder
func (*VarintBinaryEncoding) NewEncoder ¶
func (*VarintBinaryEncoding) NewEncoder(buf []byte) Encoder