git85

package
v0.0.0-...-ded6a28 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: BSD-3-Clause Imports: 3 Imported by: 3

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(dst, src []byte) (n int, err 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.

Types

type CorruptInputError

type CorruptInputError int64

func (CorruptInputError) Error

func (e CorruptInputError) Error() string

Jump to

Keyboard shortcuts

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