@Test
  public void testCloneReader() throws Exception {
    File file1 = system.createFile("testFile1");

    byte[] data = writeRandomBytes(file1);

    SeekableInputStream in = file1.getInputStream();

    // Read to partway through the file
    byte[] results1 = new byte[data.length];
    in.read(results1, 0, SMALL_CHUNK);


    // Clone the input stream. Both copies should
    // now be positioned partway through the file.
    SeekableInputStream in2 = in.clone();

    byte[] results2 = new byte[data.length];

    // Fill in the beginning of results2 with the data that it missed
    // to make testing easier.
    System.arraycopy(data, 0, results2, 0, SMALL_CHUNK);


    // Read the rest of the file with both copies
    in2.read(results2, SMALL_CHUNK, data.length);
    in.read(results1, SMALL_CHUNK, data.length);

    // Both readers should have started from the same place
    // and copied the rest of the data from the file
    assertArrayEquals(data, results1);
    assertArrayEquals(data, results2);
  }
A test of cloning a a FileInputStream. The clone should start from where the original was
positioned, but they should not hurt each other.
geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/filesystem/FileSystemJUnitTest.java