| 1 | package bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/gobscip-go gomod github.com/golang/go/src go1.13 `encoding/gob`/" |
| 5 | "ioscip-go gomod github.com/golang/go/src go1.13 io/" |
| 6 | "io/ioutilscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/" |
| 7 | "mathscip-go gomod github.com/golang/go/src go1.13 math/" |
| 8 | ) |
| 9 | |
| 10 | type spillscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill# struct { |
| 11 | Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#Buffer. |
| 12 | Spillerscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#Spiller. ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer# |
| 13 | } |
| 14 | |
| 15 | // NewSpill returns a Buffer which writes data to w when there's an error |
| 16 | // writing to buf. Such as when buf is full, or the disk is full, etc. |
| 17 | func NewSpillscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/NewSpill().(buf Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#, w ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer#) Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer# { |
| 18 | if w == nil { |
| 19 | w = ioutilscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/.Discardscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/Discard. |
| 20 | } |
| 21 | return &spillscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#{ |
| 22 | Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#Buffer.: buf, |
| 23 | Spillerscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#Spiller.: w, |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | func (buf *spillscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#) Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#Cap().() int64 { |
| 28 | return mathscip-go gomod github.com/golang/go/src go1.13 math/.MaxInt64scip-go gomod github.com/golang/go/src go1.13 math/MaxInt64. |
| 29 | } |
| 30 | |
| 31 | func (buf *spillscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#) Writescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#Write().(p []byte) (n int, err error) { |
| 32 | if n, err = buf.Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#Buffer..Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().(p); err != nil { |
| 33 | m, err := buf.Spillerscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#Spiller..Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().(p[n:]) |
| 34 | return m + n, err |
| 35 | } |
| 36 | return len(p), nil |
| 37 | } |
| 38 | |
| 39 | func initscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/init().() { |
| 40 | gobscip-go gomod github.com/golang/go/src go1.13 `encoding/gob`/.Registerscip-go gomod github.com/golang/go/src go1.13 `encoding/gob`/Register().(&spillscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/spill#{}) |
| 41 | } |