@Test public void readIntOneExtentTest() throws IOException { final Map<String,Object> extent = new HashMap<String,Object>(); extent.put("addr", Long.valueOf(42)); extent.put("len", Long.valueOf(10)); final List<Map<String,Object>> extents = Collections.singletonList(extent); final byte[] src = new byte[1024]; for (int i = 0; i < src.length; ++i) { src[i] = (byte) (i % 256); } final FSDataInputStream in = new ArrayFSDataInputStream(src); final InputStream eis = new ExtentsInputStream(in, extents); assertEquals(src[42], eis.read()); }
@Override public int read() throws IOException { final byte[] b = new byte[1]; int rlen; do { rlen = read(b, 0, 1); } while (rlen == 0); return rlen == -1 ? -1 : b[0]; }
ExtentsInputStream extends InputStream { @Override public int read() throws IOException { final byte[] b = new byte[1]; int rlen; do { rlen = read(b, 0, 1); } while (rlen == 0); return rlen == -1 ? -1 : b[0]; } }
ExtentsInputStream extends InputStream { @Override public int read() throws IOException { final byte[] b = new byte[1]; int rlen; do { rlen = read(b, 0, 1); } while (rlen == 0); return rlen == -1 ? -1 : b[0]; } ExtentsInputStream(FSDataInputStream in,
                            List<Map<String,Object>> extents); }
ExtentsInputStream extends InputStream { @Override public int read() throws IOException { final byte[] b = new byte[1]; int rlen; do { rlen = read(b, 0, 1); } while (rlen == 0); return rlen == -1 ? -1 : b[0]; } ExtentsInputStream(FSDataInputStream in,
                            List<Map<String,Object>> extents); @Override int read(); @Override int read(byte[] buf, int off, int len); }
ExtentsInputStream extends InputStream { @Override public int read() throws IOException { final byte[] b = new byte[1]; int rlen; do { rlen = read(b, 0, 1); } while (rlen == 0); return rlen == -1 ? -1 : b[0]; } ExtentsInputStream(FSDataInputStream in,
                            List<Map<String,Object>> extents); @Override int read(); @Override int read(byte[] buf, int off, int len);  }