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);
    }
  }
public boolean setPosition ( long pos ) throws IOException { if ( _readEncoding != null ) { _readEncoding = Encoding . getReadEncoding ( this , _readEncodingName ) ; } if ( pos < 0 ) { return false ; } long delta = pos - getPosition ( ) ; long newOffset = _readOffset + delta ; if ( newOffset >= 0 && newOffset < _readLength ) { _readOffset = ( int ) newOffset ; return true ; } if ( delta < 0 ) { _position = pos ; _readLength = _readOffset = 0 ; if ( _source != null ) { _source . seekStart ( pos ) ; return true ; } else { return false ; } } else { long n = pos - getPosition ( ) ; return ( skip ( n ) == n ) ; } }
Sets the current read position.