@Test public void testReset() throws Exception { String contents = "notanumber"; String testPath = createFile(contents); ProcFileReader reader = new ProcFileReader(testPath).start(); assertThat(reader.readWord(CharBuffer.allocate(20)).toString()).isEqualTo(contents); assertThat(reader.hasReachedEOF()).isTrue(); reader.reset(); assertThat(reader.readWord(CharBuffer.allocate(20)).toString()).isEqualTo(contents); assertThat(reader.hasReachedEOF()).isTrue(); }
public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } 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; }
ProcFileReader { public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } 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; } }
ProcFileReader { public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } 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; } ProcFileReader(String path);  ProcFileReader(String path, int bufferSize); }
ProcFileReader { public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } 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; } ProcFileReader(String path);  ProcFileReader(String path, int bufferSize); ProcFileReader start(); ProcFileReader reset(); boolean isValid(); boolean hasNext(); boolean hasReachedEOF(); CharBuffer readWord(CharBuffer buffer); long readNumber(); void skipSpaces(); void skipLine(); void skipPast(char skipPast); void close(); }
ProcFileReader { public ProcFileReader reset() { mIsValid = true; if (mFile != null) { try { mFile.seek(0); } catch (IOException ioe) { close(); } } 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; } ProcFileReader(String path);  ProcFileReader(String path, int bufferSize); ProcFileReader start(); ProcFileReader reset(); boolean isValid(); boolean hasNext(); boolean hasReachedEOF(); CharBuffer readWord(CharBuffer buffer); long readNumber(); void skipSpaces(); void skipLine(); void skipPast(char skipPast); void close();  }