@Test public void readBadBuffer() throws IOException { try { mTestStream.read(new byte[10], 5, 6); fail("the buffer read of invalid offset/length should fail"); } catch (IllegalArgumentException e) { assertEquals(String.format(PreconditionMessage.ERR_BUFFER_STATE.toString(), 10, 5, 6), e.getMessage()); } }
@Override public int read() throws IOException { if (mPosition == mLength) { return -1; } RetryPolicy retry = mRetryPolicySupplier.get(); IOException lastException = null; while (retry.attempt()) { try { updateStream(); int result = mBlockInStream.read(); if (result != -1) { mPosition++; } if (mBlockInStream.remaining() == 0) { closeBlockInStream(mBlockInStream); } return result; } catch (IOException e) { lastException = e; if (mBlockInStream != null) { handleRetryableException(mBlockInStream, e); mBlockInStream = null; } } } throw lastException; }
AlluxioFileInStream extends FileInStream { @Override public int read() throws IOException { if (mPosition == mLength) { return -1; } RetryPolicy retry = mRetryPolicySupplier.get(); IOException lastException = null; while (retry.attempt()) { try { updateStream(); int result = mBlockInStream.read(); if (result != -1) { mPosition++; } if (mBlockInStream.remaining() == 0) { closeBlockInStream(mBlockInStream); } return result; } catch (IOException e) { lastException = e; if (mBlockInStream != null) { handleRetryableException(mBlockInStream, e); mBlockInStream = null; } } } throw lastException; } }
AlluxioFileInStream extends FileInStream { @Override public int read() throws IOException { if (mPosition == mLength) { return -1; } RetryPolicy retry = mRetryPolicySupplier.get(); IOException lastException = null; while (retry.attempt()) { try { updateStream(); int result = mBlockInStream.read(); if (result != -1) { mPosition++; } if (mBlockInStream.remaining() == 0) { closeBlockInStream(mBlockInStream); } return result; } catch (IOException e) { lastException = e; if (mBlockInStream != null) { handleRetryableException(mBlockInStream, e); mBlockInStream = null; } } } throw lastException; } protected  AlluxioFileInStream(URIStatus status, InStreamOptions options,
      FileSystemContext context); }
AlluxioFileInStream extends FileInStream { @Override public int read() throws IOException { if (mPosition == mLength) { return -1; } RetryPolicy retry = mRetryPolicySupplier.get(); IOException lastException = null; while (retry.attempt()) { try { updateStream(); int result = mBlockInStream.read(); if (result != -1) { mPosition++; } if (mBlockInStream.remaining() == 0) { closeBlockInStream(mBlockInStream); } return result; } catch (IOException e) { lastException = e; if (mBlockInStream != null) { handleRetryableException(mBlockInStream, e); mBlockInStream = null; } } } throw lastException; } protected  AlluxioFileInStream(URIStatus status, InStreamOptions options,
      FileSystemContext context); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override void close(); @Override long remaining(); @Override int positionedRead(long pos, byte[] b, int off, int len); @Override long getPos(); @Override void seek(long pos); }
AlluxioFileInStream extends FileInStream { @Override public int read() throws IOException { if (mPosition == mLength) { return -1; } RetryPolicy retry = mRetryPolicySupplier.get(); IOException lastException = null; while (retry.attempt()) { try { updateStream(); int result = mBlockInStream.read(); if (result != -1) { mPosition++; } if (mBlockInStream.remaining() == 0) { closeBlockInStream(mBlockInStream); } return result; } catch (IOException e) { lastException = e; if (mBlockInStream != null) { handleRetryableException(mBlockInStream, e); mBlockInStream = null; } } } throw lastException; } protected  AlluxioFileInStream(URIStatus status, InStreamOptions options,
      FileSystemContext context); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override void close(); @Override long remaining(); @Override int positionedRead(long pos, byte[] b, int off, int len); @Override long getPos(); @Override void seek(long pos);  }