code: public static void writeTSV(Connection connection, String fileName, String tableReference, String encoding) throws SQLException, IOException {       
          TSVDriverFunction tSVDriverFunction = new TSVDriverFunction();
          tSVDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), encoding);
      }
docs: Export a table into a Tab-separated values file
  
  @param connection
  @param fileName
  @param tableReference
  @param encoding
  @throws SQLException
  @throws IOException