Seek to a new arbitrary location
509425
@Override
  public synchronized void seek(long targetPos) throws IOException {
    if (targetPos > getFileLength()) {
      throw new IOException("Cannot seek after EOF");
    }
    boolean done = false;
    if (pos <= targetPos && targetPos <= blockEnd) {
      //
      // If this seek is to a positive position in the current
      // block, and this piece of data might already be lying in
      // the TCP buffer, then just eat up the intervening data.
      //
      int diff = (int)(targetPos - pos);
      if (diff <= DFSClient.TCP_WINDOW_SIZE) {
        try {
          pos += blockReader.skip(diff);
          if (pos == targetPos) {
            done = true;
          }
        } catch (IOException e) {//make following read to retry
          dfsClient.incReadExpCntToStats();

          DFSClient.LOG.debug("Exception while seek to " + targetPos + " from "
                    + currentBlock +" of " + src + " from " + currentNode +
                    ": " + StringUtils.stringifyException(e));
        }
      } else {
        if (DFSClient.LOG.isDebugEnabled()) {
          DFSClient.LOG.debug("seek() out of TCP buffer " + " block "
              + currentBlock + " current pos: " + pos + " target pos: "
              + targetPos);
        }
      }
    }
    if (!done) {
      pos = targetPos;
      blockEnd = -1;
    }
  }
814952
private void lazySeek(long targetPos, long len) throws IOException {
    //For lazy seek
    seekInStream(targetPos, len);

    //re-open at specific location if needed
    if (wrappedStream == null) {
      reopen("read from new offset", targetPos, len);
    }
  }
630410
def seek(self, offset, whence=0):
        """"""
        logger.debug('seeking to offset: %r whence: %r', offset, whence)
        if whence not in s3.WHENCE_CHOICES:
            raise ValueError('invalid whence, expected one of %r' % s3.WHENCE_CHOICES)

        if not self.seekable():
            raise OSError

        if whence == s3.START:
            new_pos = offset
        elif whence == s3.CURRENT:
            new_pos = self._current_pos + offset
        elif whence == s3.END:
            new_pos = self.content_length + offset

        new_pos = s3.clamp(new_pos, 0, self.content_length)

        if self._current_pos == new_pos:
            return self._current_pos

        logger.debug("http seeking from current_pos: %d to new_pos: %d", self._current_pos, new_pos)

        self._current_pos = new_pos

        if new_pos == self.content_length:
            self.response = None
            self._read_iter = None
            self._read_buffer.empty()
        else:
            response = self._partial_request(new_pos)
            if response.ok:
                self.response = response
                self._read_iter = self.response.iter_content(self.buffer_size)
                self._read_buffer.empty()
            else:
                self.response = None

        return self._current_pos
187541
def seek(self, offset, whence=os.SEEK_SET):
        
        self.wrapped.seek(offset, whence)
868897
function (position, iteration, callback, scope) {
        var coords = _.isFunction(callback) && this.current();

        // if null or undefined implies use existing seek position
        _.isNil(position) && (position = this.position);
        _.isNil(iteration) && (iteration = this.iteration);

        // make the pointers stay within boundary
        if ((position >= this.length) || (iteration >= this.cycles) || (position < 0) || (iteration < 0) ||
            isNaN(position) || isNaN(iteration)) {
            return coords &&
                callback.call(scope || this, new Error('runcursor: seeking out of bounds: ' + [position, iteration]));
        }

        // floor the numbers
        position = ~~position;
        iteration = ~~iteration;

        // set the new positions
        this.position = Cursor.validate(position, 0, this.length);
        this.iteration = Cursor.validate(iteration, 0, this.cycles);

        // finally execute the callback with the seek position
        return coords && callback.call(scope || this, null, this.hasChanged(coords), this.current(), coords);
    }
7649
private void seekQuietly(long positiveTargetPos) {
    try {
      seek(positiveTargetPos);
    } catch (IOException ioe) {
      LOG.debug("Ignoring IOE on seek of {} to {}",
          uri, positiveTargetPos, ioe);
    }
  }
1030802
function createLocation () {
  var deferred = q.defer();

  // Make the directory, and report status
  mkdirp(globalConfig.db.location, function (err, made) {
    if(err) return deferred.reject(err);

    deferred.resolve(made);
  });

  return deferred.promise;
}
1281244
def move(self, old_path, new_path, raise_if_exists=False):
        
        if raise_if_exists and os.path.exists(new_path):
            raise FileAlreadyExists('Destination exists: %s' % new_path)
        d = os.path.dirname(new_path)
        if d and not os.path.exists(d):
            self.mkdir(d)
        try:
            os.rename(old_path, new_path)
        except OSError as err:
            if err.errno == errno.EXDEV:
                new_path_tmp = '%s-%09d' % (new_path, random.randint(0, 999999999))
                shutil.copy(old_path, new_path_tmp)
                os.rename(new_path_tmp, new_path)
                os.remove(old_path)
            else:
                raise err
510484
def destination(globs, locator, distance, bearing):
    """"""
    globs.locations.destination(distance, bearing, locator)
1223851
function locate(fn, location) {
    try {
        return fn();
    } catch (e) {
        if (e instanceof JuttleError && !e.info.location) {
            e.info.location = location;
        }

        throw e;
    }
}
668149
def move(self, place, distance = 1):
        """"""
        for d in range(distance):
            self.stream.write(self._get_cap('move '+place))
        self.flush()
1371220
function multiUpdateInLocation(queryReplacements, location) {
  location = getLocation(location);

  // if a query is there, use it, otherwise parse the search string
  const currQuery = location.query || parseQueryString(location.search);

  const newQuery = {
    ...currQuery,
    ...queryReplacements,
  };

  // remove if it is nully or an empty string when encoded
  Object.keys(queryReplacements).forEach(queryParam => {
    const encodedValue = queryReplacements[queryParam];
    if (encodedValue == null || encodedValue === '') {
      delete newQuery[queryParam];
    }
  });

  const newLocation = mergeLocationQueryOrSearch(location, newQuery);

  // remove the key from the location
  delete newLocation.key;

  return newLocation;
}
38279
public void moveLocation(double extrp, double vx, double vy)
    {
        checkHorizontalLimit(extrp, vx);
        checkVerticalLimit(extrp, vy);
    }
967096
def select_location(self):
        """"""
        location = osp.normpath(getexistingdirectory(self,
                                                     _("Select directory"),
                                                     self.location))

        if location:
            if is_writable(location):
                self.location = location
                self.update_location()
356574
def send_location(self, *args, **kwargs):
        """"""
        return send_location(*args, **self._merge_overrides(**kwargs)).run()
99395
def _construct_location_stack_entry(location, num_traverses):
    """"""
    if not isinstance(num_traverses, int) or num_traverses < 0:
        raise AssertionError(u'Attempted to create a LocationStackEntry namedtuple with an invalid '
                             u'value for "num_traverses" {}. This is not allowed.'
                             .format(num_traverses))
    if not isinstance(location, Location):
        raise AssertionError(u'Attempted to create a LocationStackEntry namedtuple with an invalid '
                             u'value for "location" {}. This is not allowed.'
                             .format(location))
    return LocationStackEntry(location=location, num_traverses=num_traverses)
585398
def seek(self, offset: int = 0, *args, **kwargs):
        

        return self.fp.seek(offset, *args, **kwargs)