public ProcFileReader reset()

in metrics/src/main/java/com/facebook/battery/metrics/core/ProcFileReader.java [52:86]


  public ProcFileReader reset() {
    // Be optimistic
    mIsValid = true;

    // First, try to move the pointer if a file exists
    if (mFile != null) {
      try {
        mFile.seek(0);
      } catch (IOException ioe) {
        close();
      }
    }

    // Otherwise try to open/reopen the file and fail
    if (mFile == null) {
      try {
        mFile = new RandomAccessFile(mPath, "r");
      } catch (IOException ioe) {
        mIsValid = false;
        close();
      }
    }

    if (mIsValid) {
      mPosition = -1;
      mBufferSize = 0;

      mChar = 0;
      mPrev = 0;

      mRewound = false;
    }

    return this;
  }