| // Copyright 2011 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| type byteReader interface { |
| // unpackBits decodes the PackBits-compressed data in src and returns the |
| // The PackBits compression format is described in section 9 (p. 42) |
| func unpackBits(r io.Reader) ([]byte, error) { |
| dst := make([]byte, 0, 1024) |
| n, err := io.ReadFull(br, buf[:code+1]) |
| dst = append(dst, buf[:n]...) |
| if b, err = br.ReadByte(); err != nil { |
| for j := 0; j < 1-code; j++ { |
| dst = append(dst, buf[:1-code]...) |