private synchronized int readInternal(byte[] b, int off, int len) throws IOException {
    checkNotClosed();
    if (finished) {
      return -1;
    }

    file.readLock().lock();
    try {
      int read = file.read(pos, b, off, len);
      if (read == -1) {
        finished = true;
      } else {
        pos += read;
      }

      file.setLastAccessTime(fileSystemState.now());
      return read;
    } 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