public synchronized OutputStream sendFile ( String fileName , long fileSize , String description ) throws XMPPException , SmackException , InterruptedException { if ( isDone ( ) || outputStream != null ) { throw new IllegalStateException ( "The negotiation process has already" + " been attempted on this file transfer" ) ; } try { setFileInfo ( fileName , fileSize ) ; this . outputStream = negotiateStream ( fileName , fileSize , description ) ; } catch ( XMPPErrorException e ) { handleXMPPException ( e ) ; throw e ; } return outputStream ; }
This method handles the negotiation of the file transfer and the stream it only returns the created stream after the negotiation has been completed .