Source File
bytereader.go
Belonging Package
github.com/klauspost/compress/fse
// Copyright 2018 Klaus Post. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.// Based on work Copyright (c) 2013, Yann Collet, released under BSD License.package fse// byteReader provides a byte reader that reads// little endian values from a byte stream.// The input stream is manually advanced.// The reader performs no bounds checks.type byteReader struct {b []byteoff int}// init will initialize the reader and set the input.func ( *byteReader) ( []byte) {.b =.off = 0}// advance the stream b n bytes.func ( *byteReader) ( uint) {.off += int()}// Uint32 returns a little endian uint32 starting at current offset.func ( byteReader) () uint32 {:= .b[.off:]= [:4]:= uint32([3]):= uint32([2]):= uint32([1]):= uint32([0])return | ( << 8) | ( << 16) | ( << 24)}// unread returns the unread portion of the input.func ( byteReader) () []byte {return .b[.off:]}// remain will return the number of bytes remaining.func ( byteReader) () int {return len(.b) - .off}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |