}
var (
- PhaseError os.Error = &Error{"phase error"};
- BufferFull os.Error = &Error{"buffer full"};
- InternalError os.Error = &Error{"bufio internal error"};
- BadBufSize os.Error = &Error{"bad bufio size"};
- ShortWrite os.Error = &Error{"short write"};
+ PhaseError os.Error = &Error{"bufio: phase error"};
+ BufferFull os.Error = &Error{"bufio: buffer full"};
+ InternalError os.Error = &Error{"bufio: internal error"};
+ BadBufSize os.Error = &Error{"bufio: bad buffer size"};
)
func copySlice(dst []byte, src []byte) {
m, e := b.wr.Write(b.buf[n:b.n]);
n += m;
if m == 0 && e == nil {
- e = ShortWrite
+ e = io.ErrShortWrite
}
if e != nil {
if n < b.n {
n, err = c.buf.Write(data);
if err == nil && c.chunking {
if n != len(data) {
- err = bufio.ShortWrite;
+ err = io.ErrShortWrite;
}
if err == nil {
io.WriteString(c.buf, "\r\n");
"os";
)
-// ErrEOF is the error returned by FullRead and Copyn when they encounter EOF.
+// Error represents an unexpected I/O behavior.
type Error struct {
os.ErrorString
}
+
+// ErrEOF means that data was expected, but a read got EOF instead.
var ErrEOF os.Error = &Error{"EOF"}
+// ErrShortWrite means that a write accepted fewer bytes than requested
+// but failed to return an explicit error.
+var ErrShortWrite os.Error = &Error{"short write"}
+
+
// Reader is the interface that wraps the basic Read method.
type Reader interface {
Read(p []byte) (n int, err os.Error);