util

package
v0.0.0-...-4413804 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2015 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const (
	Data         ControlFlag = ControlFlag('D')
	CloseChannel             = ControlFlag('C')
	FullStop                 = ControlFlag('S')
)

Variables

View Source
var (
	Transport *http.Transport
)

Functions

func BytesToUint16

func BytesToUint16(b []byte) (v uint16)

func BytesToUint32

func BytesToUint32(b []byte) (v uint32)

func BytesToUint64

func BytesToUint64(b []byte) (v uint64)

func Do

func Do(req *http.Request) (resp *http.Response, err error)

func DownloadUrl

func DownloadUrl(fileUrl string) (filename string, content []byte, e error)

func Get

func Get(url string) ([]byte, error)

func GetBufferStream

func GetBufferStream(url string, values url.Values, allocatedBytes []byte, eachBuffer func([]byte)) error

func GetUrlStream

func GetUrlStream(url string, values url.Values, readFn func(io.Reader) error) error

func NormalizeUrl

func NormalizeUrl(url string) string

func Post

func Post(url string, values url.Values) ([]byte, error)

func PostBytes

func PostBytes(url string, body []byte) ([]byte, error)

func ReadBytes

func ReadBytes(r io.Reader, lenBuf []byte) (flag ControlFlag, m *Message, err error)

data has actual data plus one byte of flag

func ReadUint64

func ReadUint64(r io.Reader) uint64

func Uint16toBytes

func Uint16toBytes(b []byte, v uint16)

func Uint32toBytes

func Uint32toBytes(b []byte, v uint32)

func Uint64toBytes

func Uint64toBytes(b []byte, v uint64)

func Uint8toBytes

func Uint8toBytes(b []byte, v uint8)

func WriteBytes

func WriteBytes(w io.Writer, lenBuf []byte, m *Message)

data has actual data plus one byte of flag

func WriteData

func WriteData(w io.Writer, lenBuf []byte, dataList ...[]byte) error

func WriteUint64

func WriteUint64(w io.Writer, number uint64)

Types

type ControlFlag

type ControlFlag byte

type Message

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

func LoadMessage

func LoadMessage(rawdata []byte) *Message

LoadMessage load from typed channels or queues

func NewMessage

func NewMessage(flag ControlFlag, data []byte) *Message

func (*Message) Bytes

func (m *Message) Bytes() []byte

func (*Message) Data

func (m *Message) Data() []byte

func (*Message) Flag

func (m *Message) Flag() ControlFlag

Jump to

Keyboard shortcuts

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