resources/src/main/java/org/robolectric/res/android/Asset.java
long handleSeek(long offset, int whence, long curPosn, long maxPosn)
  {
    long newOffset;

    switch (whence) {
      case SEEK_SET:
        newOffset = offset;
        break;
      case SEEK_CUR:
        newOffset = curPosn + offset;
        break;
      case SEEK_END:
        newOffset = maxPosn + offset;
        break;
      default:
        ALOGW("unexpected whence %d\n", whence);
        // this was happening due to an long size mismatch
        assert(false);
        return (long) -1;
    }

    if (newOffset < 0 || newOffset > maxPosn) {
      ALOGW("seek out of range: want %ld, end=%ld\n",
          (long) newOffset, (long) maxPosn);
      return (long) -1;
    }

    return newOffset;
  }
long handleSeek(long offset, int whence, long curPosn, long maxPosn)
  {
    long newOffset;

    switch (whence) {
      case SEEK_SET:
        newOffset = offset;
        break;
      case SEEK_CUR:
        newOffset = curPosn + offset;
        break;
      case SEEK_END:
        newOffset = maxPosn + offset;
        break;
      default:
        ALOGW("unexpected whence %d\n", whence);
        // this was happening due to an long size mismatch
        assert(false);
        return (long) -1;
    }

    if (newOffset < 0 || newOffset > maxPosn) {
      ALOGW("seek out of range: want %ld, end=%ld\n",
          (long) newOffset, (long) maxPosn);
      return (long) -1;
    }

    return newOffset;
  }
/*
Do generic seek() housekeeping.  Pass in the offset/whence values from
the seek request, along with the current chunk offset and the chunk
length.

Returns the new chunk offset, or -1 if the seek is illegal.