Go Home Page
The Go Programming Language

Package git85

import "encoding/git85"

Package git85 implements the radix 85 data encoding used in the Git version control system.

Package files

git.go

func Decode

func Decode(dst, src []byte) (n int, err os.Error)

Decode decodes src into at most MaxDecodedLen(len(src)) bytes, returning the actual number of bytes written to dst.

If Decode encounters invalid input, it returns a CorruptInputError.

func Encode

func Encode(dst, src []byte) int

Encode encodes src into EncodedLen(len(src)) bytes of dst. As a convenience, it returns the number of bytes written to dst, but this value is always EncodedLen(len(src)). Encode implements the radix 85 encoding used in the Git version control tool.

The encoding splits src into chunks of at most 52 bytes and encodes each chunk on its own line.

func EncodedLen

func EncodedLen(n int) int

EncodedLen returns the length of an encoding of n source bytes.

func MaxDecodedLen

func MaxDecodedLen(n int) int

func NewDecoder

func NewDecoder(r io.Reader) io.Reader

NewDecoder returns a new Git base85 stream decoder.

func NewEncoder

func NewEncoder(w io.Writer) io.WriteCloser

NewEncoder returns a new Git base85 stream encoder. Data written to the returned writer will be encoded and then written to w. The Git encoding operates on 52-byte blocks; when finished writing, the caller must Close the returned encoder to flush any partially written blocks.

type CorruptInputError

type CorruptInputError int64

func (CorruptInputError) String

func (e CorruptInputError) String() string