MCPcopy Create free account
hub / github.com/ReadyTalk/avian / seek

Method seek

classpath/java/util/zip/ZipFile.java:243–274  ·  view source on GitHub ↗
(int start, int length)

Source from the content-addressed store, hash-verified

241 }
242
243 public int seek(int start, int length) throws IOException {
244 int fileLength = (int) file.length();
245
246 if (length > data.length) {
247 throw new IllegalArgumentException
248 ("length " + length + " greater than buffer length " + data.length);
249 }
250
251 if (start < 0) {
252 throw new IllegalArgumentException("negative start " + start);
253 }
254
255 if (start + length > fileLength) {
256 throw new IllegalArgumentException
257 ("end " + (start + length) + " greater than file length " +
258 fileLength);
259 }
260
261 if (start < this.start || start + length > this.start + this.length) {
262 this.length = Math.min(data.length, fileLength);
263 this.start = start - ((this.length - length) / 2);
264 if (this.start < 0) {
265 this.start = 0;
266 } else if (this.start + this.length > fileLength) {
267 this.start = fileLength - this.length;
268 }
269 file.seek(this.start);
270 file.readFully(data, 0, this.length);
271 }
272
273 return start - this.start;
274 }
275 }
276
277 protected interface MyEntry {

Callers 5

ZipFileMethod · 0.45
get2Method · 0.45
get4Method · 0.45
entryNameMethod · 0.45
readMethod · 0.45

Calls 3

minMethod · 0.95
lengthMethod · 0.65
readFullyMethod · 0.65

Tested by

no test coverage detected