rw

package
v1.0.0-...-26db8b9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

rw is the read-write package for reading and writing types from the OrientDB binary network protocol. Reading is done via io.Reader and writing is done to bytes.Buffer (since the extra functionality of byte.Buffer is desired). All the OrientDB types are represented here for non-encoded forms. For varint and zigzag encoding/decoding handling use the obinary/varint package instead.

Index

Constants

View Source
const DEFAULT_RETVAL = 255

Variables

This section is empty.

Functions

func ReadBool

func ReadBool(rdr io.Reader) (bool, error)

Reads one byte from the Reader. If the byte is zero, then false is returned, otherwise true. If error is non-nil, then the bool value is undefined.

func ReadByte

func ReadByte(rdr io.Reader) (byte, error)

func ReadBytes

func ReadBytes(rdr io.Reader) ([]byte, error)

ReadBytes reads in an OrientDB byte array. It reads the first 4 bytes from the Reader as an int to determine the length of the byte array to read in. If the specified size of the byte array is 0 (empty) or negative (null) nil is returned for the []byte.

func ReadDouble

func ReadDouble(rdr io.Reader) (float64, error)

func ReadErrorResponse

func ReadErrorResponse(rdr io.Reader) (oerror.OServerException, error)

ReadErrorResponse reads an "Exception" message from the OrientDB server. The OrientDB server can return multiple exceptions, all of which are incorporated into a single ogonori OServerException Error struct. If error (the second return arg) is not nil, then there was a problem reading the server exception on the wire.

func ReadFloat

func ReadFloat(rdr io.Reader) (float32, error)

func ReadInt

func ReadInt(rdr io.Reader) (int32, error)

func ReadLong

func ReadLong(rdr io.Reader) (int64, error)

func ReadShort

func ReadShort(rdr io.Reader) (int16, error)

func ReadString

func ReadString(rdr io.Reader) (string, error)

ReadString xxxx If the string size is 0 an empty string and nil error are returned

func WriteBool

func WriteBool(w io.Writer, b bool) error

WriteBool writes byte(1) for true and byte(0) for false to the wfer, as specified by the OrientDB spec.

func WriteByte

func WriteByte(w io.Writer, b byte) error

func WriteBytes

func WriteBytes(w io.Writer, bs []byte) error

WriteBytes is meant to be used for writing a structure that the OrientDB will interpret as a byte array, usually a serialized datastructure. This means the first thing written to the wfer is the size of the byte array. If you want to write bytes without the the size prefix, use WriteRawBytes instead.

func WriteDouble

func WriteDouble(w io.Writer, f float64) error

WriteDouble writes a float64 in big endian order to the wfer

func WriteFloat

func WriteFloat(w io.Writer, f float32) error

WriteFloat writes a float32 in big endian order to the wfer

func WriteInt

func WriteInt(w io.Writer, n int32) error

WriteInt writes a int32 in big endian order to the wfer

func WriteLong

func WriteLong(w io.Writer, n int64) error

WriteLong writes a int64 in big endian order to the wfer

func WriteNull

func WriteNull(w io.Writer) error

func WriteRawBytes

func WriteRawBytes(w io.Writer, bs []byte) error

WriteRawBytes just writes the bytes, not prefixed by the size of the []byte

func WriteShort

func WriteShort(w io.Writer, n int16) error

WriteShort writes a int16 in big endian order to the wfer

func WriteString

func WriteString(w io.Writer, s string) error

func WriteStrings

func WriteStrings(w io.Writer, ss ...string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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