Retrieves position in the reader's input stream.
@return position in the stream or -1L if reading has failed.
519541
public long getPosition() {
		try {
			return reader.getFilePointer();
		} catch (IOException ex) {
			logger.logp(Level.SEVERE, className, "getPosition", "HPEL_ErrorReadingFileOffset", new Object[]{file, ex.getMessage()});
		}
		return -1L;
	}
593790
@Override
    public int position() {
        // if we are in transferTo mode, then this is the FileChannel position
        if (isFCEnabled()) {
            try {
                return (int) fc.position();
            } catch (IOException e) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Exception in position(): " + e);
                }
                FFDCFilter.processException(e, CLASS_NAME + ".position", "656", this);
                throw new RuntimeException(e);
            }
        }
        return super.position();
    }
1176441
public boolean setPosition(long pos)
    throws IOException
  {
    // Allow seeks to be reflected in the char Reader.
    if (_readEncoding != null) {
      _readEncoding = Encoding.getReadEncoding(this, _readEncodingName);
    }
    
    if (pos < 0) {
      // Return error on seek to negative stream position

      return false;
    }
    
    long delta = pos - getPosition();
    
    long newOffset = _readOffset + delta;
    
    if (newOffset >= 0 && newOffset < _readLength) {
      _readOffset = (int) newOffset;
      
      return true;
    }
    
    if (delta < 0) {
      // Seek backwards in the stream

      _position = pos;
      _readLength = _readOffset = 0;

      if (_source != null) {
        _source.seekStart(pos);

        return true;
      }
      else {
        return false;
      }
    }
    else {
      // Seek forward in the stream, skip any buffered bytes

      long n = pos - getPosition();

      return (skip(n) == n);
    }
  }
504338
public function tell()
    {
        if (!$this->isClosed()) {
            $pos = ftell($this->handle);
        }
        
        if (!isset($pos) || $pos === false) {
            throw new \RuntimeException("Failed to get the position of the stream");
        }
        
        return $pos;
    }
1123397
public function tell(): int
    {
        if ($this->isAttached() === false || ($position = ftell($this->stream)) === false) {
            throw new RuntimeException('Could not get the position of the pointer in stream');
        }

        return $position;
    }
634743
public int read() throws IOException {
        int b = in.read();
        if (b != -1) {
            cksum.update(b);
        }
        return b;
    }
590228
def get_position(stream=STD_OUTPUT_HANDLE):
    '''  '''
    stream = kernel32.GetStdHandle(stream)
    csbi = CONSOLE_SCREEN_BUFFER_INFO()
    kernel32.GetConsoleScreenBufferInfo(stream, byref(csbi))

    pos = csbi.dwCursorPosition
    # zero based, add ones for compatibility.
    return (pos.X + 1, pos.Y + 1)
1343576
public Long getPosition() {
        Interval interval = getInterval();
        if (interval != null) {
            return interval.getMinStart();
        } else {
            return null;
        }
    }
553673
private long getCurrentPosition() {
        long pos;
        if (!useLoadBuf) {
            return in.position();
        }
        try {
            if (in != null) {
                pos = (channel.position() - in.remaining());
            } else {
                pos = channel.position();
            }
            return pos;
        } catch (Exception e) {
            log.error("Error getCurrentPosition", e);
            return 0;
        }
    }
515126
public Integer getEnd() {
    if (mtasPositionType.equals(POSITION_RANGE)
        || mtasPositionType.equals(POSITION_SET)) {
      return mtasPositionEnd;
    } else if (mtasPositionType.equals(POSITION_SINGLE)) {
      return mtasPositionStart;
    } else {
      return null;
    }
  }
996058
@Override
  public synchronized long getPos() throws IOException {
    long pos = channel.position();
    logger.atFine().log("getPos: %d", pos);
    return pos;
  }
1039757
private int get() throws IOException {
        int c = theLookahead;
        theLookahead = EOF;
        if (c == EOF) {
            c = inputStream.read();
        }
        if (c >= ' ' || c == '\n' || c == EOF) {
            return c;
        }
        if (c == '\r') {
            return '\n';
        }
        return ' ';
    }
1047202
@Override
    public int read() throws IOException {
        try {
            beforeRead(1);
            int b = in.read();
            afterRead(b != -1 ? 1 : -1);
            return b;
        } catch (IOException e) {
            handleIOException(e);
            return -1;
        }
    }
80960
public float getProgress() throws IOException {
    if (start == end) {
      return 0.0f;
    } else {
      return Math.min(1.0f, (pos - start) / (float) (end - start));
    }
  }
382145
protected Reader getNextInputReader() throws IOException {
		if (iter == null) {
			return null;
		}
		if (!iter.hasNext()) {
			return null;
		}
		Object o = iter.next();
		if (o instanceof Reader) {
			return (Reader)o;
		} else if (o instanceof InputStream) {
			return new InputStreamReader((InputStream)o, "UTF-8"); //$NON-NLS-1$
		}
		return new StringReader(o.toString());
	}
535663
private boolean goToNextStartPosition() throws IOException {
    int nextSpans1StartPosition;
    while ((nextSpans1StartPosition = spans1.spans
        .nextStartPosition()) != NO_MORE_POSITIONS) {
      if (nextSpans1StartPosition == lastSpans2EndPosition) {
        return true;
      } else {
        // clean up
        if (maximumSpans2EndPosition < nextSpans1StartPosition) {
          previousSpans2EndPositions.clear();
          maximumSpans2EndPosition = -1;
        } else if (previousSpans2EndPositions
            .contains(nextSpans1StartPosition)) {
          return true;
        }
        // try to find match
        while (lastSpans2StartPosition < nextSpans1StartPosition) {
          if (lastSpans2StartPosition != NO_MORE_POSITIONS) {
            lastSpans2StartPosition = spans2.spans.nextStartPosition();
          }
          if (lastSpans2StartPosition == NO_MORE_POSITIONS) {
            if (previousSpans2EndPositions.isEmpty()) {
              noMorePositions = true;
              return false;
            }
          } else {
            lastSpans2EndPosition = spans2.spans.endPosition();
            if (lastSpans2EndPosition >= nextSpans1StartPosition) {
              previousSpans2EndPositions.add(lastSpans2EndPosition);
              maximumSpans2EndPosition = Math.max(maximumSpans2EndPosition,
                  lastSpans2EndPosition);
            }
            if (nextSpans1StartPosition == lastSpans2EndPosition) {
              return true;
            }
          }
        }
      }
    }
    return false;
  }
887061
public static int getLineAtPosition( JTextComponent editor, int position )
  {
    if( position <= 0 )
    {
      return 1;
    }

    String s = editor.getText();
    if( position > s.length() )
    {
      position = s.length();
    }

    try
    {
      return GosuStringUtil.countMatches( editor.getText( 0, position ), "\n" ) + 1;
    }
    catch( BadLocationException e )
    {
      throw new RuntimeException( e );
    }
  }