code: public SftpFile openFile(String absolutePath, int flags,
  			SftpFileAttributes attrs) throws SftpStatusException, SshException {
  		if (attrs == null) {
  			attrs = new SftpFileAttributes(this,
  					SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN);
  		}
  
  		try {
  			UnsignedInteger32 requestId = nextRequestId();
  			Packet msg = createPacket();
  			msg.write(SSH_FXP_OPEN);
  			msg.writeInt(requestId.longValue());
  			msg.writeString(absolutePath, CHARSET_ENCODING);
  			msg.writeInt(flags);
  			msg.write(attrs.toByteArray());
  
  			sendMessage(msg);
  
  			byte[] handle = getHandleResponse(requestId);
  
  			SftpFile file = new SftpFile(absolutePath, null);
  			file.setHandle(handle);
  			file.setSFTPSubsystem(this);
  
  			EventServiceImplementation.getInstance().fireEvent(
  					(new Event(this, J2SSHEventCodes.EVENT_SFTP_FILE_OPENED,
  							true)).addAttribute(
  							J2SSHEventCodes.ATTRIBUTE_FILE_NAME,
  							file.getAbsolutePath()));
  			return file;
  		} catch (SshIOException ex) {
  			throw ex.getRealException();
  		} catch (IOException ex) {
  			throw new SshException(ex);
  		}
  	}
docs: Open a file.
  
  @param absolutePath
  @param flags
  @param attrs
  @return SftpFile
  @throws SftpStatusException
  , SshException