Movatterモバイル変換


[0]ホーム

URL:


Notice  The highest tagged major version isv5.

binary

package
v4.7.0+incompatibleLatest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License:Apache-2.0Imports:4Imported by:0

Details

Repository

github.com/go-git/go-git

Links

Documentation

Overview

Package binary implements sintax-sugar functions on top of the standardlibrary binary package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcIsBinary

func IsBinary(rio.Reader) (bool,error)

IsBinary detects if data is a binary value based on:http://git.kernel.org/cgit/git/git.git/tree/xdiff-interface.c?id=HEAD#n198

funcRead

func Read(rio.Reader, data ...interface{})error

Read reads structured binary data from r into data. Bytes are read anddecoded in BigEndian orderhttps://golang.org/pkg/encoding/binary/#Read

funcReadHash

func ReadHash(rio.Reader) (plumbing.Hash,error)

ReadHash reads a plumbing.Hash from r

funcReadUint16

func ReadUint16(rio.Reader) (uint16,error)

ReadUint16 reads 2 bytes and returns them as a BigEndian uint16

funcReadUint32

func ReadUint32(rio.Reader) (uint32,error)

ReadUint32 reads 4 bytes and returns them as a BigEndian uint32

funcReadUint64

func ReadUint64(rio.Reader) (uint64,error)

ReadUint64 reads 8 bytes and returns them as a BigEndian uint32

funcReadUntil

func ReadUntil(rio.Reader, delimbyte) ([]byte,error)

ReadUntil reads from r untin delim is found

funcReadVariableWidthInt

func ReadVariableWidthInt(rio.Reader) (int64,error)

ReadVariableWidthInt reads and returns an int in Git VLQ special format:

Ordinary VLQ has some redundancies, example: the number 358 can beencoded as the 2-octet VLQ 0x8166 or the 3-octet VLQ 0x808166 or the4-octet VLQ 0x80808166 and so forth.

To avoid these redundancies, the VLQ format used in Git removes thisprepending redundancy and extends the representable range of shorterVLQs by adding an offset to VLQs of 2 or more octets in such a waythat the lowest possible value for such an (N+1)-octet VLQ becomesexactly one more than the maximum possible value for an N-octet VLQ.In particular, since a 1-octet VLQ can store a maximum value of 127,the minimum 2-octet VLQ (0x8000) is assigned the value 128 instead of0. Conversely, the maximum value of such a 2-octet VLQ (0xff7f) is16511 instead of just 16383. Similarly, the minimum 3-octet VLQ(0x808000) has a value of 16512 instead of zero, which meansthat the maximum 3-octet VLQ (0xffff7f) is 2113663 instead ofjust 2097151. And so forth.

This is how the offset is saved in C:

dheader[pos] = ofs & 127;while (ofs >>= 7)    dheader[--pos] = 128 | (--ofs & 127);

funcWrite

func Write(wio.Writer, data ...interface{})error

Write writes the binary representation of data into w, using BigEndian orderhttps://golang.org/pkg/encoding/binary/#Write

funcWriteUint16

func WriteUint16(wio.Writer, valueuint16)error

WriteUint16 writes the binary representation of a uint16 into w, in BigEndianorder

funcWriteUint32

func WriteUint32(wio.Writer, valueuint32)error

WriteUint32 writes the binary representation of a uint32 into w, in BigEndianorder

funcWriteUint64

func WriteUint64(wio.Writer, valueuint64)error

WriteUint64 writes the binary representation of a uint64 into w, in BigEndianorder

funcWriteVariableWidthInt

func WriteVariableWidthInt(wio.Writer, nint64)error

Types

This section is empty.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp