@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();
    }
  }
@Test
  public void testRead_singleByte() throws IOException {
    JimfsInputStream in = newInputStream(2);
    assertThat(in.read()).isEqualTo(2);
    assertEmpty(in);
  }