code: public int readFile(byte[] handle, UnsignedInteger64 offset, byte[] output,
  			int off, int len) throws SftpStatusException, SshException {
  
  		try {
  			if ((output.length - off) < len) {
  				throw new IndexOutOfBoundsException(
  						"Output array size is smaller than read length!");
  			}
  
  			UnsignedInteger32 requestId = nextRequestId();
  			Packet msg = createPacket();
  			msg.write(SSH_FXP_READ);
  			msg.writeInt(requestId.longValue());
  			msg.writeBinaryString(handle);
  			msg.write(offset.toByteArray());
  			msg.writeInt(len);
  
  			sendMessage(msg);
  
  			SftpMessage bar = getResponse(requestId);
  
  			if (bar.getType() == SSH_FXP_DATA) {
  				byte[] msgdata = bar.readBinaryString();
  				System.arraycopy(msgdata, 0, output, off, msgdata.length);
  				return msgdata.length;
  			} else if (bar.getType() == SSH_FXP_STATUS) {
  				int status = (int) bar.readInt();
  				if (status == SftpStatusException.SSH_FX_EOF)
  					return -1;
  				if (version >= 3) {
  					String desc = bar.readString().trim();
  					throw new SftpStatusException(status, desc);
  				}
  				throw new SftpStatusException(status);
  			} else {
  				close();
  				throw new SshException(
  						"The server responded with an unexpected message",
  						SshException.CHANNEL_FAILURE);
  			}
  		} catch (SshIOException ex) {
  			throw ex.getRealException();
  		} catch (IOException ex) {
  			throw new SshException(ex);
  		}
  
  	}
docs: Read a block of data from an open file.
  
  @param handle
  the open file handle
  @param offset
  the offset to start reading in the file
  @param output
  a buffer to write the returned data to
  @param off
  the starting offset in the output buffer
  @param len
  the length of data to read
  @return int
  @throws SshException