public void sendData ( byte [ ] data ) throws ResponseException { if ( con . isClosed ( ) ) return ; Socket socket = null ; try { socket = conHandler . createDataSocket ( ) ; dataConnections . add ( socket ) ; OutputStream out = socket . getOutputStream ( ) ; Utils . write ( out , data , data . length , conHandler . isAsciiMode ( ) ) ; bytesTransferred += data . length ; out . flush ( ) ; Utils . closeQuietly ( out ) ; Utils . closeQuietly ( socket ) ; } catch ( SocketException ex ) { throw new ResponseException ( 426 , "Transfer aborted" ) ; } catch ( IOException ex ) { throw new ResponseException ( 425 , "An error occurred while transferring the data" ) ; } finally { onUpdate ( ) ; if ( socket != null ) dataConnections . remove ( socket ) ; } }
Sends an array of bytes through a data connection