code: public void sendData(InputStream in) throws ResponseException {
          if(con.isClosed()) return;
  
          Socket socket = null;
          try {
              socket = conHandler.createDataSocket();
              dataConnections.add(socket);
              OutputStream out = socket.getOutputStream();
  
              byte[] buffer = new byte[bufferSize];
              int len;
              while((len = in.read(buffer)) != -1) {
                  Utils.write(out, buffer, len, conHandler.isAsciiMode());
                  bytesTransferred += len;
              }
  
              out.flush();
              Utils.closeQuietly(out);
              Utils.closeQuietly(in);
              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);
          }
      }
docs: Sends a stream through a data connection
  @param in The input stream
  @throws ResponseException When an error occurs