Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / libgo / go / io / io.go
index 5187eff..859adaf 100644 (file)
@@ -216,6 +216,11 @@ type ByteScanner interface {
        UnreadByte() error
 }
 
+// ByteWriter is the interface that wraps the WriteByte method.
+type ByteWriter interface {
+       WriteByte(c byte) error
+}
+
 // RuneReader is the interface that wraps the ReadRune method.
 //
 // ReadRune reads a single UTF-8 encoded Unicode character
@@ -463,6 +468,11 @@ func (s *SectionReader) ReadAt(p []byte, off int64) (n int, err error) {
        off += s.base
        if max := s.limit - off; int64(len(p)) > max {
                p = p[0:max]
+               n, err = s.r.ReadAt(p, off)
+               if err == nil {
+                       err = EOF
+               }
+               return n, err
        }
        return s.r.ReadAt(p, off)
 }