spy(webIn.getReadRunner().getInputStream()); doThrow(ex).when(spyInputStream).read((byte[])any(), anyInt(), anyInt()); final WebHdfsFileSystem.ReadRunner rr = spy(webIn.getReadRunner()); doReturn(spyInputStream) .when(rr).initializeInputStream((HttpURLConnection) any()); rr.setInputStream(spyInputStream); webIn.setReadRunner(rr); webIn.read(); fail(msg + ": Read should have thrown exception."); } catch (Exception e) { webIn.close(); in.close();
@SuppressWarnings("resource") @Override public FSDataInputStream open(final Path f, final int bufferSize ) throws IOException { statistics.incrementReadOps(1); storageStatistics.incrementOpCounter(OpType.OPEN); WebHdfsInputStream webfsInputStream = new WebHdfsInputStream(f, bufferSize); if (webfsInputStream.getFileEncryptionInfo() == null) { return new FSDataInputStream(webfsInputStream); } else { return new FSDataInputStream( webfsInputStream.createWrappedInputStream()); } }
@Override public FSDataInputStream open(final Path f, final int bufferSize ) throws IOException { statistics.incrementReadOps(1); return new FSDataInputStream(new WebHdfsInputStream(f, bufferSize)); }
InputStream createWrappedInputStream() throws IOException { return HdfsKMSUtil.createWrappedInputStream( this, getKeyProvider(), getFileEncryptionInfo(), getConf()); } }
@Override public FSDataInputStream open(final Path f, final int bufferSize ) throws IOException { statistics.incrementReadOps(1); return new FSDataInputStream(new WebHdfsInputStream(f, bufferSize)); }
@Override public int read() throws IOException { final byte[] b = new byte[1]; return (read(b, 0, 1) == -1) ? -1 : (b[0] & 0xff); }
@Override public int read() throws IOException { final byte[] b = new byte[1]; return (read(b, 0, 1) == -1) ? -1 : (b[0] & 0xff); }
@Override public int read() throws IOException { final byte[] b = new byte[1]; return (read(b, 0, 1) == -1) ? -1 : (b[0] & 0xff); }