Package binary implements the Thrift Binary protocol.

    See "".Binary for a higher-level Encode/Decode API.



    This section is empty.


    This section is empty.


    func IsDecodeError

    func IsDecodeError(e error) bool

      IsDecodeError checks if an error is a protocol decode error.

      func ReturnWriter

      func ReturnWriter(w *Writer)

        ReturnWriter returns a previously borrowed Writer back to the system.


        type Reader

        type Reader struct {
        	// contains filtered or unexported fields

          Reader implements a parser for the Thrift Binary Protocol based on an io.ReaderAt.

          func NewReader

          func NewReader(r io.ReaderAt) Reader

            NewReader builds a new Reader based on the given io.ReaderAt.

            func (*Reader) ReadEnveloped

            func (bw *Reader) ReadEnveloped() (wire.Envelope, error)

              ReadEnveloped reads an Apache Thrift envelope

              Thrift supports two kinds of envelopes: strict, and non-strict.

              Non-strict envelopes: Name (4 byte length prefixed string) Type ID (1 byte) Sequence ID (4 bytes)

              Strict envelopes:

              Version | Type ID (4 bytes) Name (4 byte length prefixed string) Sequence ID (4 bytes)

              When reading payloads, we need to support both strict and non-strict payloads. To do this, we read the first 4 byte. Non-strict payloads will always have a size >= 0, while strict payloads have selected version numbers such that the value will always be negative.

              func (*Reader) ReadValue

              func (br *Reader) ReadValue(t wire.Type, off int64) (wire.Value, int64, error)

                ReadValue reads a value off the given type off the wire starting at the given offset.

                Returns the Value, the new offset, and an error if there was a decode error.

                type Writer

                type Writer struct {
                	// contains filtered or unexported fields

                  Writer implements basic logic for writing the Thrift Binary Protocol to an io.Writer.

                  func BorrowWriter

                  func BorrowWriter(w io.Writer) *Writer

                    BorrowWriter fetches a Writer from the system that will write its output to the given io.Writer.

                    This Writer must be returned back using ReturnWriter.

                    func (*Writer) WriteEnveloped

                    func (bw *Writer) WriteEnveloped(e wire.Envelope) error

                      WriteEnveloped writes enveloped value using the strict envelope.

                      func (*Writer) WriteLegacyEnveloped

                      func (bw *Writer) WriteLegacyEnveloped(e wire.Envelope) error

                        WriteLegacyEnveloped writes enveloped value using the non-strict envelope (non-strict lacks an envelope version).

                        func (*Writer) WriteValue

                        func (bw *Writer) WriteValue(v wire.Value) error

                          WriteValue writes the given Thrift value to the underlying stream using the Thrift Binary Protocol.