コード例 #1
0
 public void seekRelative(long relativeOffset) throws IOException {
   ensureReadyOnFirstUse();
   long pos = streamDataInput.getAbsolutePosition();
   pos += relativeOffset;
   if (pos < filePositionOfStreamData) pos = filePositionOfStreamData;
   // It's alright to seek beyond the end, it's just that read operations will fail
   streamDataInput.seekAbsolute(pos);
 }
コード例 #2
0
 private void endCurrentUse() throws IOException {
   // System.out.println("SICW.endCurrentUse()  About to ... " + this);
   if (usedYet) {
     streamDataInput.seekAbsolute(filePositionBeforeUse);
     usedYet = false;
   }
   endThreadAccess();
   // System.out.println("SICW.endCurrentUse()  ... Done     " + this);
 }
コード例 #3
0
  private void ensureReadyOnFirstUse() throws IOException {
    beginThreadAccess();
    if (usedYet) return;
    usedYet = true;

    // System.out.println("SICW.ensureReadyOnFirstUse()  About to ... " + this);
    filePositionBeforeUse = streamDataInput.getAbsolutePosition();
    streamDataInput.seekAbsolute(filePositionOfStreamData);
    // System.out.println("SICW.ensureReadyOnFirstUse()  ... Done     " + this);
  }
コード例 #4
0
 public void seekAbsolute(long absolutePosition) throws IOException {
   ensureReadyOnFirstUse();
   // The wrapper exists in a different coordinate system,
   //   where its beginning is location 0
   if (absolutePosition < 0L)
     throw new IOException("Attempt to absolutely seek to negative location: " + absolutePosition);
   // It's alright to seek beyond the end, it's just that read operations will fail
   absolutePosition += filePositionOfStreamData;
   streamDataInput.seekAbsolute(absolutePosition);
 }
コード例 #5
0
 public void seekEnd() throws IOException {
   ensureReadyOnFirstUse();
   streamDataInput.seekAbsolute(filePositionOfStreamData + lengthOfStreamData);
 }