encodeio

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package encodeio supply some utility functions for encoding

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(r io.Reader, v interface{}, decoder DecodeFunc) error

func ReadGOB

func ReadGOB(r io.Reader, v interface{}) error

func ReadGZIP

func ReadGZIP(r io.Reader) ([]byte, error)

func ReadJSON

func ReadJSON(r io.Reader, v interface{}) error

func ReadString

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

func ReadXML

func ReadXML(r io.Reader, v interface{}) error

func Write

func Write(w io.Writer, v interface{}, encoder EncodeFunc) error

Write write a interface{} to writer use given encoder

func WriteGOB

func WriteGOB(w io.Writer, v interface{}) error

WriteGOB write interface{} to writer use gob encoder

func WriteGZIP

func WriteGZIP(w io.Writer, v interface{}) (err error)

func WriteJSON

func WriteJSON(w io.Writer, v interface{}) error

WriteJSON write interface{} to writer use json encoder

func WriteString

func WriteString(w io.Writer, str string) (int, error)

WriteString write string to writer

func WriteXML

func WriteXML(w io.Writer, v interface{}) error

WriteXML write interface{} to writer use xml encoder

Types

type DecodeFunc

type DecodeFunc func([]byte, interface{}) error

DecodeFunc decode bytes to a interface{}, interface{} must be pointer

type EncodeFunc

type EncodeFunc func(interface{}) ([]byte, error)

EncodeFunc encode a interface{} to bytes

Directories

Path Synopsis
Package file help read from/write to config file
Package file help read from/write to config file

Jump to

Keyboard shortcuts

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