public static int osd_fseek(Object file, int offset, int whence) {
        FakeFileHandle f = (FakeFileHandle) file;
        int err = 0;

        switch (f.type) {
            case kPlainFile:
                if (whence == SEEK_SET) {
                    fseek(f.file, offset, SEEK_SET);
                    return 0;
                } else if (whence == SEEK_CUR) {
                    fseek(f.file, offset, SEEK_CUR);
                    return 0;
                } else {
                    throw new UnsupportedOperationException("FSEEK other than SEEK_SET NOT SUPPORTED.");
                }
            //break;
            case kZippedFile:
            case kRAMFile:
                /* seeking within the RAM image of a file */
                switch (whence) {
                    case SEEK_SET:
                        f.offset = offset;
                        break;
                    case SEEK_CUR:
                        f.offset += offset;
                        break;
                    case SEEK_END:
                        f.offset = f.length + offset;
                        break;
                }
                break;
        }

        return err;
    }