| 1 | package bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ |
| 2 | |
| 3 | import ( |
| 4 | "ioscip-go gomod github.com/golang/go/src go1.13 io/" |
| 5 | "mathscip-go gomod github.com/golang/go/src go1.13 math/" |
| 6 | |
| 7 | "github.com/djherbis/buffer/wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/" |
| 8 | ) |
| 9 | |
| 10 | type ringscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring# struct { |
| 11 | BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt. |
| 12 | Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L. int64 |
| 13 | *wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.WrapReaderscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapReader. |
| 14 | *wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.WrapWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapWriter. |
| 15 | } |
| 16 | |
| 17 | // NewRing returns a Ring Buffer from a BufferAt. |
| 18 | // It overwrites old data in the Buffer when needed (when its full). |
| 19 | func NewRingscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/NewRing().(buffer BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/BufferAt#) Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer# { |
| 20 | return &ringscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#{ |
| 21 | BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt.: buffer, |
| 22 | WrapReaderscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapReader.: wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.NewWrapReaderscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/NewWrapReader().(buffer, 0, buffer.Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.()), |
| 23 | WrapWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapWriter.: wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.NewWrapWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/NewWrapWriter().(buffer, 0, buffer.Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.()), |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | func (buf *ringscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#) Lenscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#Len().() int64 { |
| 28 | return buf.Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L. |
| 29 | } |
| 30 | |
| 31 | func (buf *ringscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#) Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#Cap().() int64 { |
| 32 | return mathscip-go gomod github.com/golang/go/src go1.13 math/.MaxInt64scip-go gomod github.com/golang/go/src go1.13 math/MaxInt64. |
| 33 | } |
| 34 | |
| 35 | func (buf *ringscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#) Readscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#Read().(p []byte) (n int, err error) { |
| 36 | if buf.Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L. == buf.BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt..Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.() { |
| 37 | buf.WrapReaderscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapReader..Seekscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/wrapper#Seek().(buf.WrapWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapWriter..Offsetscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/wrapper#Offset().(), 0) |
| 38 | } |
| 39 | n, err = ioscip-go gomod github.com/golang/go/src go1.13 io/.LimitReaderscip-go gomod github.com/golang/go/src go1.13 io/LimitReader().(buf.WrapReaderscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapReader., buf.Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L.).Readscip-go gomod github.com/golang/go/src go1.13 io/Reader#Read().(p) |
| 40 | buf.Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L. -= int64(n) |
| 41 | return n, err |
| 42 | } |
| 43 | |
| 44 | func (buf *ringscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#) Writescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#Write().(p []byte) (n int, err error) { |
| 45 | n, err = buf.WrapWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapWriter..Writescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/WrapWriter#Write().(p) |
| 46 | buf.Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L. += int64(n) |
| 47 | if buf.Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L. > buf.BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt..Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.() { |
| 48 | buf.Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L. = buf.BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt..Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.() |
| 49 | } |
| 50 | return n, err |
| 51 | } |
| 52 | |
| 53 | func (buf *ringscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#) Resetscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#Reset().() { |
| 54 | buf.BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt..Resetscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Reset.() |
| 55 | buf.Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#L. = 0 |
| 56 | buf.WrapReaderscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapReader. = wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.NewWrapReaderscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/NewWrapReader().(buf.BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt., 0, buf.BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt..Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.()) |
| 57 | buf.WrapWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#WrapWriter. = wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.NewWrapWriterscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/NewWrapWriter().(buf.BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt., 0, buf.BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/ring#BufferAt..Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.()) |
| 58 | } |