code: public int read(byte[] buffer, int offset, int len) throws IOException {
  
  		try {
  
  			if (isEOF && currentMessageRemaining == 0) {
  				return -1;
  			}
  
  			int read = 0;
  			int wantsLength = len;
  			while (read < wantsLength && !isEOF) {
  
  				if (currentMessage == null || currentMessageRemaining == 0) {
  					bufferNextMessage();
  					if (isEOF && read == 0) {
  						return -1;
  					}
  				}
  
  				if (currentMessage == null)
  					throw new IOException(
  							"Failed to obtain file data or status from the SFTP server!");
  
  				int count = Math.min(currentMessageRemaining, len);
  
  				System.arraycopy(currentMessage.array(),
  						currentMessage.getPosition(), buffer, offset, count);
  
  				currentMessageRemaining -= count;
  				currentMessage.skip(count);
  
  				if (currentMessageRemaining == 0) {
  					bufferNextMessage();
  				}
  				read += count;
  				len -= count;
  				offset += count;
  
  			}
  
  			return read;
  		} catch (SshException ex) {
  			throw new SshIOException(ex);
  		} catch (SftpStatusException ex) {
  			throw new IOException(ex.getMessage());
  		}
  	}
docs: /*
  (non-Javadoc)
  
  @see java.io.InputStream#read(byte[], int, int)