public static void writeTuple(TupleQueryResult tqr,QueryResultFormat format,OutputStream out) throws IOException, TupleQueryResultHandlerException, UnsupportedQueryResultFormatException, QueryEvaluationException {
  TupleQueryResultWriter writer=createTupleWriter(format,out);
  try {
    writer.startDocument();
    writer.startHeader();
    QueryResults.report(tqr,writer);
  }
 catch (  QueryResultHandlerException e) {
    if (e.getCause() instanceof IOException) {
      throw (IOException)e.getCause();
    }
 else     if (e instanceof TupleQueryResultHandlerException) {
      throw (TupleQueryResultHandlerException)e;
    }
 else {
      throw new TupleQueryResultHandlerException(e);
    }
  }
}

public static void writeTuple ( TupleQueryResult tqr , QueryResultFormat format , OutputStream out ) throws IOException , TupleQueryResultHandlerException , UnsupportedQueryResultFormatException , QueryEvaluationException { TupleQueryResultWriter writer = createTupleWriter ( format , out ) ; try { writer . startDocument ( ) ; writer . startHeader ( ) ; QueryResults . report ( tqr , writer ) ; } catch ( QueryResultHandlerException e ) { if ( e . getCause ( ) instanceof IOException ) { throw ( IOException ) e . getCause ( ) ; } else if ( e instanceof TupleQueryResultHandlerException ) { throw ( TupleQueryResultHandlerException ) e ; } else { throw new TupleQueryResultHandlerException ( e ) ; } } }
writes a query result document in a specific query result format to an output stream .
