| 1 | package limioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/ |
| 2 | |
| 3 | import "ioscip-go gomod github.com/golang/go/src go1.13 io/" |
| 4 | |
| 5 | type limitedWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter# struct { |
| 6 | Wscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#W. ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer# |
| 7 | Nscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#N. int64 |
| 8 | } |
| 9 | |
| 10 | func (l *limitedWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#) Writescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#Write().(p []byte) (n int, err error) { |
| 11 | if l.Nscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#N. <= 0 { |
| 12 | return 0, ioscip-go gomod github.com/golang/go/src go1.13 io/.ErrShortWritescip-go gomod github.com/golang/go/src go1.13 io/ErrShortWrite. |
| 13 | } |
| 14 | if int64(len(p)) > l.Nscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#N. { |
| 15 | p = p[0:l.Nscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#N.] |
| 16 | err = ioscip-go gomod github.com/golang/go/src go1.13 io/.ErrShortWritescip-go gomod github.com/golang/go/src go1.13 io/ErrShortWrite. |
| 17 | } |
| 18 | n, er := l.Wscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#W..Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().(p) |
| 19 | if er != nil { |
| 20 | err = er |
| 21 | } |
| 22 | l.Nscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#N. -= int64(n) |
| 23 | return n, err |
| 24 | } |
| 25 | |
| 26 | // LimitWriter works like io.LimitReader. It writes at most n bytes |
| 27 | // to the underlying Writer. It returns io.ErrShortWrite if more than n |
| 28 | // bytes are attempted to be written. |
| 29 | func LimitWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/LimitWriter().(w ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer#, n int64) ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer# { |
| 30 | return &limitedWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#{Wscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#W.: w, Nscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/limio`/limitedWriter#N.: n} |
| 31 | } |