MCPcopy Create free account
hub / github.com/bodgit/sevenzip / Read

Method Read

reader.go:90–119  ·  view source on GitHub ↗
(p []byte)

Source from the content-addressed store, hash-verified

88}
89
90func (fr *fileReader) Read(p []byte) (int, error) {
91 if len(p) == 0 {
92 return 0, nil
93 }
94
95 if fr.n <= 0 {
96 return 0, io.EOF
97 }
98
99 if int64(len(p)) > fr.n {
100 p = p[0:fr.n]
101 }
102
103 n, err := fr.rc.Read(p)
104 fr.n -= int64(n)
105
106 if err != nil && !errors.Is(err, io.EOF) {
107 e := &ReadError{
108 Err: err,
109 }
110
111 if frc, ok := fr.rc.(*folderReadCloser); ok {
112 e.Encrypted = frc.hasEncryption
113 }
114
115 return n, e
116 }
117
118 return n, err //nolint:wrapcheck
119}
120
121func (fr *fileReader) Close() error {
122 if fr.rc == nil {

Callers

nothing calls this directly

Calls 1

ReadMethod · 0.45

Tested by

no test coverage detected