### Question:
FileQueue extends InputStream { @Override public int read() throws IOException { final int tmp = read(z); return tmp == -1 ? -1 : (0xFF & z[0]); } FileQueue(CombineFileSplit split, Configuration conf); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override void close();  }### Answer:
@Test public void testRepeat() throws Exception { final Configuration conf = new Configuration(); Arrays.fill(loc, ""); Arrays.fill(start, 0L); Arrays.fill(len, BLOCK); final ByteArrayOutputStream out = fillVerif(); final FileQueue q = new FileQueue(new CombineFileSplit(paths, start, len, loc), conf); final byte[] verif = out.toByteArray(); final byte[] check = new byte[2 * NFILES * BLOCK]; q.read(check, 0, NFILES * BLOCK); assertArrayEquals(verif, Arrays.copyOf(check, NFILES * BLOCK)); final byte[] verif2 = new byte[2 * NFILES * BLOCK]; System.arraycopy(verif, 0, verif2, 0, verif.length); System.arraycopy(verif, 0, verif2, verif.length, verif.length); q.read(check, 0, 2 * NFILES * BLOCK); assertArrayEquals(verif2, check); }
@Test public void testUneven() throws Exception { final Configuration conf = new Configuration(); Arrays.fill(loc, ""); Arrays.fill(start, 0L); Arrays.fill(len, BLOCK); final int B2 = BLOCK / 2; for (int i = 0; i < NFILES; i += 2) { start[i] += B2; len[i] -= B2; } final FileQueue q = new FileQueue(new CombineFileSplit(paths, start, len, loc), conf); final ByteArrayOutputStream out = fillVerif(); final byte[] verif = out.toByteArray(); final byte[] check = new byte[NFILES / 2 * BLOCK + NFILES / 2 * B2]; q.read(check, 0, verif.length); assertArrayEquals(verif, Arrays.copyOf(check, verif.length)); q.read(check, 0, verif.length); assertArrayEquals(verif, Arrays.copyOf(check, verif.length)); }