Debian Codegraph @

buffer.go

raw symbols SCIP
1 // Package buffer implements a series of Buffers which can be composed to implement complicated buffering strategies
2 package bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/
3
4 import (
5 "ioscip-go gomod github.com/golang/go/src go1.13 io/"
6 "osscip-go gomod github.com/golang/go/src go1.13 os/"
7 )
8
9 // Buffer is used to Write() data which will be Read() later.
10 type Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer# interface {
11 Lenscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Len.() int64 // How much data is Buffered in bytes
12 Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.() int64 // How much data can be Buffered at once in bytes.
13 ioscip-go gomod github.com/golang/go/src go1.13 io/.Readerscip-go gomod github.com/golang/go/src go1.13 io/Reader# // Read() will read from the top of the buffer [io.EOF if empty]
14 ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer# // Write() will write to the end of the buffer [io.ErrShortWrite if not enough space]
15 Resetscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Reset.() // Truncates the buffer, Len() == 0.
16 }
17
18 // BufferAt is a buffer which supports io.ReaderAt and io.WriterAt
19 type BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/BufferAt# interface {
20 Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#
21 ioscip-go gomod github.com/golang/go/src go1.13 io/.ReaderAtscip-go gomod github.com/golang/go/src go1.13 io/ReaderAt#
22 ioscip-go gomod github.com/golang/go/src go1.13 io/.WriterAtscip-go gomod github.com/golang/go/src go1.13 io/WriterAt#
23 }
24
25 func len64scip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/len64().(p []byte) int64 {
26 return int64(len(p))
27 }
28
29 // Gap returns buf.Cap() - buf.Len()
30 func Gapscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Gap().(buf Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#) int64 {
31 return buf.Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.() - buf.Lenscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Len.()
32 }
33
34 // Full returns true iff buf.Len() == buf.Cap()
35 func Fullscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Full().(buf Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#) bool {
36 return buf.Lenscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Len.() == buf.Capscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Cap.()
37 }
38
39 // Empty returns false iff buf.Len() == 0
40 func Emptyscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Empty().(buf Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#) bool {
41 return buf.Lenscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer#Len.() == 0
42 }
43
44 // NewUnboundedBuffer returns a Buffer which buffers "mem" bytes to memory
45 // and then creates file's of size "file" to buffer above "mem" bytes.
46 func NewUnboundedBufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/NewUnboundedBuffer().(mem, file int64) Bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/Buffer# {
47 return NewMultiscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/NewMulti().(Newscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/New().(mem), NewPartitionscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/NewPartition().(NewFilePoolscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/NewFilePool().(file, osscip-go gomod github.com/golang/go/src go1.13 os/.TempDirscip-go gomod github.com/golang/go/src go1.13 os/TempDir().())))
48 }