Debian Codegraph @

file.go

raw symbols SCIP
1 package bufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/
2
3 import (
4 "bytesscip-go gomod github.com/golang/go/src go1.13 bytes/"
5 "encoding/gobscip-go gomod github.com/golang/go/src go1.13 `encoding/gob`/"
6 "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/"
7 "ioscip-go gomod github.com/golang/go/src go1.13 io/"
8 "osscip-go gomod github.com/golang/go/src go1.13 os/"
9 "path/filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/"
10
11 "github.com/djherbis/buffer/wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/"
12 )
13
14 // File is used as the backing resource for a the NewFile BufferAt.
15 type Filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File# interface {
16 Namescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File#Name.() string
17 Statscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File#Stat.() (fi osscip-go gomod github.com/golang/go/src go1.13 os/.FileInfoscip-go gomod github.com/golang/go/src go1.13 os/FileInfo#, err error)
18 ioscip-go gomod github.com/golang/go/src go1.13 io/.ReaderAtscip-go gomod github.com/golang/go/src go1.13 io/ReaderAt#
19 ioscip-go gomod github.com/golang/go/src go1.13 io/.WriterAtscip-go gomod github.com/golang/go/src go1.13 io/WriterAt#
20 Closescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File#Close.() error
21 }
22
23 type fileBufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer# struct {
24 filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#file. Filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File#
25 *wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.Wrapperscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#Wrapper.
26 }
27
28 // NewFile returns a new BufferAt backed by "file" with max-size N.
29 func NewFilescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/NewFile().(N int64, file Filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File#) BufferAtscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/BufferAt# {
30 return &fileBufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#{
31 filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#file.: file,
32 Wrapperscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#Wrapper.: wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.NewWrapperscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/NewWrapper().(file, 0, 0, N),
33 }
34 }
35
36 func initscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/init().() {
37 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().(&fileBufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#{})
38 }
39
40 func (buf *fileBufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#) MarshalBinaryscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#MarshalBinary().() ([]byte, error) {
41 fullpath, err := filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.Absscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/Abs().(filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.Dirscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/Dir().(buf.filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#file..Namescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File#Name.()))
42 if err != nil {
43 return nil, err
44 }
45 base := filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.Basescip-go gomod github.com/golang/go/src go1.13 `path/filepath`/Base().(buf.filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#file..Namescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File#Name.())
46 buf.filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#file..Closescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/File#Close.()
47
48 buffer := bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.NewBufferscip-go gomod github.com/golang/go/src go1.13 bytes/NewBuffer().(nil)
49 fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Fprintlnscip-go gomod github.com/golang/go/src go1.13 fmt/Fprintln().(buffer, filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.Joinscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/Join().(fullpath, base))
50 fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Fprintlnscip-go gomod github.com/golang/go/src go1.13 fmt/Fprintln().(buffer, buf.Wrapperscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#Wrapper..Nscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/Wrapper#N., buf.Wrapperscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#Wrapper..Lscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/Wrapper#L., buf.Wrapperscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#Wrapper..Oscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/Wrapper#O.)
51 return buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), nil
52 }
53
54 func (buf *fileBufferscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#) UnmarshalBinaryscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#UnmarshalBinary().(data []byte) error {
55 buffer := bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.NewBufferscip-go gomod github.com/golang/go/src go1.13 bytes/NewBuffer().(data)
56 var filename string
57 var N, L, O int64
58 _, err := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Fscanlnscip-go gomod github.com/golang/go/src go1.13 fmt/Fscanln().(buffer, &filename)
59 if err != nil {
60 return err
61 }
62
63 file, err := osscip-go gomod github.com/golang/go/src go1.13 os/.Openscip-go gomod github.com/golang/go/src go1.13 os/Open().(filename)
64 if err != nil {
65 return err
66 }
67 buf.filescip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#file. = file
68
69 _, err = fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Fscanlnscip-go gomod github.com/golang/go/src go1.13 fmt/Fscanln().(buffer, &N, &L, &O)
70 buf.Wrapperscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer`/fileBuffer#Wrapper. = wrapioscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/.NewWrapperscip-go gomod github.com/djherbis/buffer . `github.com/djherbis/buffer/wrapio`/NewWrapper().(file, L, O, N)
71 return err
72 }