Read at most size bytes from the chunk. If size is omitted or negative, read until the end of the chunk.
(self, size=-1)
| 176 | return self.size_read |
| 177 | |
| 178 | def read(self, size=-1): |
| 179 | """Read at most size bytes from the chunk. |
| 180 | If size is omitted or negative, read until the end |
| 181 | of the chunk. |
| 182 | """ |
| 183 | |
| 184 | if self.closed: |
| 185 | raise ValueError("I/O operation on closed file") |
| 186 | if self.size_read >= self.chunksize: |
| 187 | return b'' |
| 188 | if size < 0: |
| 189 | size = self.chunksize - self.size_read |
| 190 | if size > self.chunksize - self.size_read: |
| 191 | size = self.chunksize - self.size_read |
| 192 | data = self.file.read(size) |
| 193 | self.size_read = self.size_read + len(data) |
| 194 | if self.size_read == self.chunksize and \ |
| 195 | self.align and \ |
| 196 | (self.chunksize & 1): |
| 197 | dummy = self.file.read(1) |
| 198 | self.size_read = self.size_read + len(dummy) |
| 199 | return data |
| 200 | |
| 201 | def skip(self): |
| 202 | """Skip the rest of the chunk. |
nothing calls this directly
no outgoing calls
no test coverage detected