summaryrefslogtreecommitdiff
path: root/src/pkg/compress/bzip2/bit_reader.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/compress/bzip2/bit_reader.go')
-rw-r--r--src/pkg/compress/bzip2/bit_reader.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/pkg/compress/bzip2/bit_reader.go b/src/pkg/compress/bzip2/bit_reader.go
index 50f0ec836..b35c69a1c 100644
--- a/src/pkg/compress/bzip2/bit_reader.go
+++ b/src/pkg/compress/bzip2/bit_reader.go
@@ -7,25 +7,24 @@ package bzip2
import (
"bufio"
"io"
- "os"
)
// bitReader wraps an io.Reader and provides the ability to read values,
-// bit-by-bit, from it. Its Read* methods don't return the usual os.Error
+// bit-by-bit, from it. Its Read* methods don't return the usual error
// because the error handling was verbose. Instead, any error is kept and can
// be checked afterwards.
type bitReader struct {
r byteReader
n uint64
bits uint
- err os.Error
+ err error
}
-// bitReader needs to read bytes from an io.Reader. We attempt to cast the
+// bitReader needs to read bytes from an io.Reader. We attempt to convert the
// given io.Reader to this interface and, if it doesn't already fit, we wrap in
// a bufio.Reader.
type byteReader interface {
- ReadByte() (byte, os.Error)
+ ReadByte() (byte, error)
}
func newBitReader(r io.Reader) bitReader {
@@ -38,11 +37,11 @@ func newBitReader(r io.Reader) bitReader {
// ReadBits64 reads the given number of bits and returns them in the
// least-significant part of a uint64. In the event of an error, it returns 0
-// and the error can be obtained by calling Error().
+// and the error can be obtained by calling Err().
func (br *bitReader) ReadBits64(bits uint) (n uint64) {
for bits > br.bits {
b, err := br.r.ReadByte()
- if err == os.EOF {
+ if err == io.EOF {
err = io.ErrUnexpectedEOF
}
if err != nil {
@@ -83,6 +82,6 @@ func (br *bitReader) ReadBit() bool {
return n != 0
}
-func (br *bitReader) Error() os.Error {
+func (br *bitReader) Err() error {
return br.err
}