@Override
  public synchronized int read() throws IOException {
    checkNotClosed();
    if (finished) {
      return -1;
    }

    file.readLock().lock();
    try {

      int b = file.read(pos++); // it's ok for pos to go beyond size()
      if (b == -1) {
        finished = true;
      } else {
        file.setLastAccessTime(fileSystemState.now());
      }
      return b;
    } finally {
      file.readLock().unlock();
    }
  }
{@link InputStream} for reading from a file's {@link RegularFile}.

@author Colin Decker
jimfs/src/main/java/com/google/common/jimfs/JimfsInputStream.java