001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 3.0.12 004 * 005 * Do not make changes to this file unless you know what you are doing--modify 006 * the SWIG interface file instead. 007 * ----------------------------------------------------------------------------- */ 008 009package org.sbml.libsbml; 010 011/** 012 * Interface to an XML output stream. 013 <p> 014 * <p style='color: #777; font-style: italic'> 015This class of objects is defined by libSBML only and has no direct 016equivalent in terms of SBML components. This class is not prescribed by 017the SBML specifications, although it is used to implement features 018defined in SBML. 019</p> 020 021 <p> 022 * SBML content is serialized using XML; the resulting data can be stored and 023 * read to/from a file or data stream. Low-level XML parsers such as Xerces 024 * provide facilities to read XML data. To permit the use of different XML 025 * parsers (Xerces, Expat or libxml2), libSBML implements an abstraction 026 * layer. {@link XMLInputStream} and {@link XMLOutputStream} are two parts of that 027 * abstraction layer. 028 <p> 029 * {@link XMLOutputStream} provides a wrapper above output streams to facilitate 030 * writing XML. {@link XMLOutputStream} keeps track of start and end elements, 031 * indentation, XML namespace prefixes, and more. The interface provides 032 * features for converting non-text data types into appropriate textual form; 033 * this takes the form of overloaded <code>writeAttribute(...)</code> methods 034 * that allow users to simply use the same method with any data type. For 035 * example, suppose an element <code>testElement</code> has two attributes, <code>size</code> and 036 * <code>id</code>, and the attributes are variables in your code as follows: 037<p> 038<pre class='fragment'> 039double size = 3.2; 040String id = 'id'; 041</pre> 042<p> 043 * Then, the element and the attributes can be written to the 044 * standard output stream (provided as <code>cout</code> in the libSBML 045 * language bindings) as follows: 046<p> 047<pre class='fragment'> 048import org.sbml.libsbml.XMLOutputStream; 049import org.sbml.libsbml.libsbml; 050 051public class test 052{ 053 public static void main (String[] args) 054 { 055 double size = 3.2; 056 String id = 'id'; 057 058 // Create an {@link XMLOutputStream} object that will write to the 059 // standard output stream, which is provide in libSBML's 060 // Java language interface as the object 'libsbml.cout'. 061 062 {@link XMLOutputStream} xos = new {@link XMLOutputStream}(libsbml.cout); 063 064 // Create the start element, write the attributes, and close 065 // the element. The output will be written immediately as 066 // each method is called. 067 068 xos.startElement('testElement'); 069 xos.writeAttribute('size', size); 070 xos.writeAttribute('id', id); 071 xos.endElement('testElement'); 072 } 073 074 static 075 { 076 System.loadLibrary('sbmlj'); 077 } 078} 079</pre> 080<p> 081 * Other classes in SBML take {@link XMLOutputStream} objects as arguments, and use 082 * that to write elements and attributes seamlessly to the XML output stream. 083 <p> 084 * It is also worth noting that unlike {@link XMLInputStream}, {@link XMLOutputStream} is 085 * actually independent of the underlying XML parsers. It does not use the 086 * XML parser libraries at all. 087 <p> 088 * @note The convenience of the {@link XMLInputStream} and {@link XMLOutputStream} 089 * abstraction may be useful for developers interested in creating parsers 090 * for other XML formats besides SBML. It can provide developers with a 091 * layer above more basic XML parsers, as well as some useful programmatic 092 * elements such as {@link XMLToken}, {@link XMLError}, etc. 093 <p> 094 * @see XMLInputStream 095 */ 096 097public class XMLOutputStream { 098 private long swigCPtr; 099 protected boolean swigCMemOwn; 100 101 protected XMLOutputStream(long cPtr, boolean cMemoryOwn) 102 { 103 swigCMemOwn = cMemoryOwn; 104 swigCPtr = cPtr; 105 } 106 107 protected static long getCPtr(XMLOutputStream obj) 108 { 109 return (obj == null) ? 0 : obj.swigCPtr; 110 } 111 112 protected static long getCPtrAndDisown (XMLOutputStream obj) 113 { 114 long ptr = 0; 115 116 if (obj != null) 117 { 118 ptr = obj.swigCPtr; 119 obj.swigCMemOwn = false; 120 } 121 122 return ptr; 123 } 124 125 protected void finalize() { 126 delete(); 127 } 128 129 public synchronized void delete() { 130 if (swigCPtr != 0) { 131 if (swigCMemOwn) { 132 swigCMemOwn = false; 133 libsbmlJNI.delete_XMLOutputStream(swigCPtr); 134 } 135 swigCPtr = 0; 136 } 137 } 138 139 /** 140 * Equality comparison method for XMLOutputStream. 141 * <p> 142 * Because the Java methods for libSBML are actually wrappers around code 143 * implemented in C++ and C, certain operations will not behave as 144 * expected. Equality comparison is one such case. An instance of a 145 * libSBML object class is actually a <em>proxy object</em> 146 * wrapping the real underlying C/C++ object. The normal <code>==</code> 147 * equality operator in Java will <em>only compare the Java proxy objects</em>, 148 * not the underlying native object. The result is almost never what you 149 * want in practical situations. Unfortunately, Java does not provide a 150 * way to override <code>==</code>. 151 * <p> 152 * The alternative that must be followed is to use the 153 * <code>equals()</code> method. The <code>equals</code> method on this 154 * class overrides the default java.lang.Object one, and performs an 155 * intelligent comparison of instances of objects of this class. The 156 * result is an assessment of whether two libSBML Java objects are truly 157 * the same underlying native-code objects. 158 * <p> 159 * The use of this method in practice is the same as the use of any other 160 * Java <code>equals</code> method. For example, 161 * <em>a</em><code>.equals(</code><em>b</em><code>)</code> returns 162 * <code>true</code> if <em>a</em> and <em>b</em> are references to the 163 * same underlying object. 164 * 165 * @param sb a reference to an object to which the current object 166 * instance will be compared 167 * 168 * @return <code>true</code> if <code>sb</code> refers to the same underlying 169 * native object as this one, <code>false</code> otherwise 170 */ 171 public boolean equals(Object sb) 172 { 173 if ( this == sb ) 174 { 175 return true; 176 } 177 return swigCPtr == getCPtr((XMLOutputStream)(sb)); 178 } 179 180 /** 181 * Returns a hashcode for this XMLOutputStream object. 182 * 183 * @return a hash code usable by Java methods that need them. 184 */ 185 public int hashCode() 186 { 187 return (int)(swigCPtr^(swigCPtr>>>32)); 188 } 189 190 191/** 192 * Creates a new {@link XMLOutputStream} that wraps the given <code>stream</code>. 193 <p> 194 * <p> 195 * The functionality associated with the <code>programName</code> and 196 * <code>programVersion</code> arguments concerns an optional comment that libSBML can 197 * write at the beginning of the output stream. The comment is intended 198 * for human readers of the XML file, and has the following form: 199 * <pre class='fragment'> 200<!-- Created by <program name> version <program version> 201on yyyy-MM-dd HH:mm with libSBML version <libsbml version>. --> 202</pre> 203 <p> 204 * This program information comment is a separate item from the XML 205 * declaration that this method can also write to this output stream. The 206 * comment is also not mandated by any SBML specification. This libSBML 207 * functionality is provided for the convenience of calling programs, and to 208 * help humans trace the origin of SBML files. 209 <p> 210 * <p> 211 * The XML declaration has the form 212 * <pre class='fragment'> 213<?xml version='1.0' encoding='UTF-8'?> 214</pre> 215 * Note that the SBML specifications require the use of UTF-8 encoding and 216 * version 1.0, so for SBML documents, the above is the standard XML 217 * declaration. 218 <p> 219 * @param stream the input stream to wrap. 220 <p> 221 * @param encoding the XML encoding to declare in the output. This value 222 * should be <code>'UTF-8'</code> for SBML documents. The default value 223 * is <code>'UTF-8'</code> if no value is supplied for this parameter. 224 <p> 225 * @param writeXMLDecl whether to write a standard XML declaration at 226 * the beginning of the content written on <code>stream</code>. The default is 227 * <code>true.</code> 228 <p> 229 * @param programName an optional program name to write as a comment 230 * in the output stream. 231 <p> 232 * @param programVersion an optional version identification string to write 233 * as a comment in the output stream. 234 <p> 235 * 236</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 237The native C++ implementation of this method defines a default argument 238value. In the documentation generated for different libSBML language 239bindings, you may or may not see corresponding arguments in the method 240declarations. For example, in Java and C#, a default argument is handled by 241declaring two separate methods, with one of them having the argument and 242the other one lacking the argument. However, the libSBML documentation will 243be <em>identical</em> for both methods. Consequently, if you are reading 244this and do not see an argument even though one is described, please look 245for descriptions of other variants of this method near where this one 246appears in the documentation. 247</dd></dl> 248 249 */ public 250 XMLOutputStream(OStream stream, String encoding, boolean writeXMLDecl, String programName, String programVersion) throws org.sbml.libsbml.XMLConstructorException { 251 this(libsbmlJNI.new_XMLOutputStream__SWIG_0(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, encoding, writeXMLDecl, programName, programVersion), true); 252 } 253 254 255/** 256 * Creates a new {@link XMLOutputStream} that wraps the given <code>stream</code>. 257 <p> 258 * <p> 259 * The functionality associated with the <code>programName</code> and 260 * <code>programVersion</code> arguments concerns an optional comment that libSBML can 261 * write at the beginning of the output stream. The comment is intended 262 * for human readers of the XML file, and has the following form: 263 * <pre class='fragment'> 264<!-- Created by <program name> version <program version> 265on yyyy-MM-dd HH:mm with libSBML version <libsbml version>. --> 266</pre> 267 <p> 268 * This program information comment is a separate item from the XML 269 * declaration that this method can also write to this output stream. The 270 * comment is also not mandated by any SBML specification. This libSBML 271 * functionality is provided for the convenience of calling programs, and to 272 * help humans trace the origin of SBML files. 273 <p> 274 * <p> 275 * The XML declaration has the form 276 * <pre class='fragment'> 277<?xml version='1.0' encoding='UTF-8'?> 278</pre> 279 * Note that the SBML specifications require the use of UTF-8 encoding and 280 * version 1.0, so for SBML documents, the above is the standard XML 281 * declaration. 282 <p> 283 * @param stream the input stream to wrap. 284 <p> 285 * @param encoding the XML encoding to declare in the output. This value 286 * should be <code>'UTF-8'</code> for SBML documents. The default value 287 * is <code>'UTF-8'</code> if no value is supplied for this parameter. 288 <p> 289 * @param writeXMLDecl whether to write a standard XML declaration at 290 * the beginning of the content written on <code>stream</code>. The default is 291 * <code>true.</code> 292 <p> 293 * @param programName an optional program name to write as a comment 294 * in the output stream. 295 <p> 296 * @param programVersion an optional version identification string to write 297 * as a comment in the output stream. 298 <p> 299 * 300</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 301The native C++ implementation of this method defines a default argument 302value. In the documentation generated for different libSBML language 303bindings, you may or may not see corresponding arguments in the method 304declarations. For example, in Java and C#, a default argument is handled by 305declaring two separate methods, with one of them having the argument and 306the other one lacking the argument. However, the libSBML documentation will 307be <em>identical</em> for both methods. Consequently, if you are reading 308this and do not see an argument even though one is described, please look 309for descriptions of other variants of this method near where this one 310appears in the documentation. 311</dd></dl> 312 313 */ public 314 XMLOutputStream(OStream stream, String encoding, boolean writeXMLDecl, String programName) throws org.sbml.libsbml.XMLConstructorException { 315 this(libsbmlJNI.new_XMLOutputStream__SWIG_1(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, encoding, writeXMLDecl, programName), true); 316 } 317 318 319/** 320 * Creates a new {@link XMLOutputStream} that wraps the given <code>stream</code>. 321 <p> 322 * <p> 323 * The functionality associated with the <code>programName</code> and 324 * <code>programVersion</code> arguments concerns an optional comment that libSBML can 325 * write at the beginning of the output stream. The comment is intended 326 * for human readers of the XML file, and has the following form: 327 * <pre class='fragment'> 328<!-- Created by <program name> version <program version> 329on yyyy-MM-dd HH:mm with libSBML version <libsbml version>. --> 330</pre> 331 <p> 332 * This program information comment is a separate item from the XML 333 * declaration that this method can also write to this output stream. The 334 * comment is also not mandated by any SBML specification. This libSBML 335 * functionality is provided for the convenience of calling programs, and to 336 * help humans trace the origin of SBML files. 337 <p> 338 * <p> 339 * The XML declaration has the form 340 * <pre class='fragment'> 341<?xml version='1.0' encoding='UTF-8'?> 342</pre> 343 * Note that the SBML specifications require the use of UTF-8 encoding and 344 * version 1.0, so for SBML documents, the above is the standard XML 345 * declaration. 346 <p> 347 * @param stream the input stream to wrap. 348 <p> 349 * @param encoding the XML encoding to declare in the output. This value 350 * should be <code>'UTF-8'</code> for SBML documents. The default value 351 * is <code>'UTF-8'</code> if no value is supplied for this parameter. 352 <p> 353 * @param writeXMLDecl whether to write a standard XML declaration at 354 * the beginning of the content written on <code>stream</code>. The default is 355 * <code>true.</code> 356 <p> 357 * @param programName an optional program name to write as a comment 358 * in the output stream. 359 <p> 360 * @param programVersion an optional version identification string to write 361 * as a comment in the output stream. 362 <p> 363 * 364</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 365The native C++ implementation of this method defines a default argument 366value. In the documentation generated for different libSBML language 367bindings, you may or may not see corresponding arguments in the method 368declarations. For example, in Java and C#, a default argument is handled by 369declaring two separate methods, with one of them having the argument and 370the other one lacking the argument. However, the libSBML documentation will 371be <em>identical</em> for both methods. Consequently, if you are reading 372this and do not see an argument even though one is described, please look 373for descriptions of other variants of this method near where this one 374appears in the documentation. 375</dd></dl> 376 377 */ public 378 XMLOutputStream(OStream stream, String encoding, boolean writeXMLDecl) throws org.sbml.libsbml.XMLConstructorException { 379 this(libsbmlJNI.new_XMLOutputStream__SWIG_2(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, encoding, writeXMLDecl), true); 380 } 381 382 383/** 384 * Creates a new {@link XMLOutputStream} that wraps the given <code>stream</code>. 385 <p> 386 * <p> 387 * The functionality associated with the <code>programName</code> and 388 * <code>programVersion</code> arguments concerns an optional comment that libSBML can 389 * write at the beginning of the output stream. The comment is intended 390 * for human readers of the XML file, and has the following form: 391 * <pre class='fragment'> 392<!-- Created by <program name> version <program version> 393on yyyy-MM-dd HH:mm with libSBML version <libsbml version>. --> 394</pre> 395 <p> 396 * This program information comment is a separate item from the XML 397 * declaration that this method can also write to this output stream. The 398 * comment is also not mandated by any SBML specification. This libSBML 399 * functionality is provided for the convenience of calling programs, and to 400 * help humans trace the origin of SBML files. 401 <p> 402 * <p> 403 * The XML declaration has the form 404 * <pre class='fragment'> 405<?xml version='1.0' encoding='UTF-8'?> 406</pre> 407 * Note that the SBML specifications require the use of UTF-8 encoding and 408 * version 1.0, so for SBML documents, the above is the standard XML 409 * declaration. 410 <p> 411 * @param stream the input stream to wrap. 412 <p> 413 * @param encoding the XML encoding to declare in the output. This value 414 * should be <code>'UTF-8'</code> for SBML documents. The default value 415 * is <code>'UTF-8'</code> if no value is supplied for this parameter. 416 <p> 417 * @param writeXMLDecl whether to write a standard XML declaration at 418 * the beginning of the content written on <code>stream</code>. The default is 419 * <code>true.</code> 420 <p> 421 * @param programName an optional program name to write as a comment 422 * in the output stream. 423 <p> 424 * @param programVersion an optional version identification string to write 425 * as a comment in the output stream. 426 <p> 427 * 428</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 429The native C++ implementation of this method defines a default argument 430value. In the documentation generated for different libSBML language 431bindings, you may or may not see corresponding arguments in the method 432declarations. For example, in Java and C#, a default argument is handled by 433declaring two separate methods, with one of them having the argument and 434the other one lacking the argument. However, the libSBML documentation will 435be <em>identical</em> for both methods. Consequently, if you are reading 436this and do not see an argument even though one is described, please look 437for descriptions of other variants of this method near where this one 438appears in the documentation. 439</dd></dl> 440 441 */ public 442 XMLOutputStream(OStream stream, String encoding) throws org.sbml.libsbml.XMLConstructorException { 443 this(libsbmlJNI.new_XMLOutputStream__SWIG_3(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream, encoding), true); 444 } 445 446 447/** 448 * Creates a new {@link XMLOutputStream} that wraps the given <code>stream</code>. 449 <p> 450 * <p> 451 * The functionality associated with the <code>programName</code> and 452 * <code>programVersion</code> arguments concerns an optional comment that libSBML can 453 * write at the beginning of the output stream. The comment is intended 454 * for human readers of the XML file, and has the following form: 455 * <pre class='fragment'> 456<!-- Created by <program name> version <program version> 457on yyyy-MM-dd HH:mm with libSBML version <libsbml version>. --> 458</pre> 459 <p> 460 * This program information comment is a separate item from the XML 461 * declaration that this method can also write to this output stream. The 462 * comment is also not mandated by any SBML specification. This libSBML 463 * functionality is provided for the convenience of calling programs, and to 464 * help humans trace the origin of SBML files. 465 <p> 466 * <p> 467 * The XML declaration has the form 468 * <pre class='fragment'> 469<?xml version='1.0' encoding='UTF-8'?> 470</pre> 471 * Note that the SBML specifications require the use of UTF-8 encoding and 472 * version 1.0, so for SBML documents, the above is the standard XML 473 * declaration. 474 <p> 475 * @param stream the input stream to wrap. 476 <p> 477 * @param encoding the XML encoding to declare in the output. This value 478 * should be <code>'UTF-8'</code> for SBML documents. The default value 479 * is <code>'UTF-8'</code> if no value is supplied for this parameter. 480 <p> 481 * @param writeXMLDecl whether to write a standard XML declaration at 482 * the beginning of the content written on <code>stream</code>. The default is 483 * <code>true.</code> 484 <p> 485 * @param programName an optional program name to write as a comment 486 * in the output stream. 487 <p> 488 * @param programVersion an optional version identification string to write 489 * as a comment in the output stream. 490 <p> 491 * 492</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 493The native C++ implementation of this method defines a default argument 494value. In the documentation generated for different libSBML language 495bindings, you may or may not see corresponding arguments in the method 496declarations. For example, in Java and C#, a default argument is handled by 497declaring two separate methods, with one of them having the argument and 498the other one lacking the argument. However, the libSBML documentation will 499be <em>identical</em> for both methods. Consequently, if you are reading 500this and do not see an argument even though one is described, please look 501for descriptions of other variants of this method near where this one 502appears in the documentation. 503</dd></dl> 504 505 */ public 506 XMLOutputStream(OStream stream) throws org.sbml.libsbml.XMLConstructorException { 507 this(libsbmlJNI.new_XMLOutputStream__SWIG_4(SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), stream), true); 508 } 509 510 511/** 512 * Writes the given XML end element name to this {@link XMLOutputStream}. 513 <p> 514 * @param name the name of the element. 515 <p> 516 * @param prefix an optional XML namespace prefix to write in front of the 517 * <code>element</code> name. (The result has the form 518 * <code><em>prefix</em>:<em>name</em></code>.) 519 <p> 520 * 521</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 522The native C++ implementation of this method defines a default argument 523value. In the documentation generated for different libSBML language 524bindings, you may or may not see corresponding arguments in the method 525declarations. For example, in Java and C#, a default argument is handled by 526declaring two separate methods, with one of them having the argument and 527the other one lacking the argument. However, the libSBML documentation will 528be <em>identical</em> for both methods. Consequently, if you are reading 529this and do not see an argument even though one is described, please look 530for descriptions of other variants of this method near where this one 531appears in the documentation. 532</dd></dl> 533 534 */ public 535 void endElement(String name, String prefix) { 536 libsbmlJNI.XMLOutputStream_endElement__SWIG_0(swigCPtr, this, name, prefix); 537 } 538 539 540/** 541 * Writes the given XML end element name to this {@link XMLOutputStream}. 542 <p> 543 * @param name the name of the element. 544 <p> 545 * @param prefix an optional XML namespace prefix to write in front of the 546 * <code>element</code> name. (The result has the form 547 * <code><em>prefix</em>:<em>name</em></code>.) 548 <p> 549 * 550</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 551The native C++ implementation of this method defines a default argument 552value. In the documentation generated for different libSBML language 553bindings, you may or may not see corresponding arguments in the method 554declarations. For example, in Java and C#, a default argument is handled by 555declaring two separate methods, with one of them having the argument and 556the other one lacking the argument. However, the libSBML documentation will 557be <em>identical</em> for both methods. Consequently, if you are reading 558this and do not see an argument even though one is described, please look 559for descriptions of other variants of this method near where this one 560appears in the documentation. 561</dd></dl> 562 563 */ public 564 void endElement(String name) { 565 libsbmlJNI.XMLOutputStream_endElement__SWIG_1(swigCPtr, this, name); 566 } 567 568 569/** 570 * Writes the given element to the stream. 571 <p> 572 * @param triple the XML element to write. 573 */ public 574 void endElement(XMLTriple triple, boolean text) { 575 libsbmlJNI.XMLOutputStream_endElement__SWIG_2(swigCPtr, this, XMLTriple.getCPtr(triple), triple, text); 576 } 577 578 579/** 580 * Writes the given element to the stream. 581 <p> 582 * @param triple the XML element to write. 583 */ public 584 void endElement(XMLTriple triple) { 585 libsbmlJNI.XMLOutputStream_endElement__SWIG_3(swigCPtr, this, XMLTriple.getCPtr(triple), triple); 586 } 587 588 589/** 590 * Turns automatic indentation on or off for this {@link XMLOutputStream}. 591 <p> 592 * @param indent if <code>true</code>, automatic indentation is turned on. 593 */ public 594 void setAutoIndent(boolean indent) { 595 libsbmlJNI.XMLOutputStream_setAutoIndent(swigCPtr, this, indent); 596 } 597 598 599/** 600 * Writes the given XML start element name to this {@link XMLOutputStream}. 601 <p> 602 * @param name the name of the element. 603 <p> 604 * @param prefix an optional XML namespace prefix to write in front of the 605 * <code>element</code> name. (The result has the form 606 * <code><em>prefix</em>:<em>name</em></code>.) 607 <p> 608 * 609</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 610The native C++ implementation of this method defines a default argument 611value. In the documentation generated for different libSBML language 612bindings, you may or may not see corresponding arguments in the method 613declarations. For example, in Java and C#, a default argument is handled by 614declaring two separate methods, with one of them having the argument and 615the other one lacking the argument. However, the libSBML documentation will 616be <em>identical</em> for both methods. Consequently, if you are reading 617this and do not see an argument even though one is described, please look 618for descriptions of other variants of this method near where this one 619appears in the documentation. 620</dd></dl> 621 622 */ public 623 void startElement(String name, String prefix) { 624 libsbmlJNI.XMLOutputStream_startElement__SWIG_0(swigCPtr, this, name, prefix); 625 } 626 627 628/** 629 * Writes the given XML start element name to this {@link XMLOutputStream}. 630 <p> 631 * @param name the name of the element. 632 <p> 633 * @param prefix an optional XML namespace prefix to write in front of the 634 * <code>element</code> name. (The result has the form 635 * <code><em>prefix</em>:<em>name</em></code>.) 636 <p> 637 * 638</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 639The native C++ implementation of this method defines a default argument 640value. In the documentation generated for different libSBML language 641bindings, you may or may not see corresponding arguments in the method 642declarations. For example, in Java and C#, a default argument is handled by 643declaring two separate methods, with one of them having the argument and 644the other one lacking the argument. However, the libSBML documentation will 645be <em>identical</em> for both methods. Consequently, if you are reading 646this and do not see an argument even though one is described, please look 647for descriptions of other variants of this method near where this one 648appears in the documentation. 649</dd></dl> 650 651 */ public 652 void startElement(String name) { 653 libsbmlJNI.XMLOutputStream_startElement__SWIG_1(swigCPtr, this, name); 654 } 655 656 657/** 658 * Writes the given XML start element 659 * <code><em>prefix</em>:<em>name</em></code> on this output stream. 660 <p> 661 * @param triple the start element to write. 662 */ public 663 void startElement(XMLTriple triple) { 664 libsbmlJNI.XMLOutputStream_startElement__SWIG_2(swigCPtr, this, XMLTriple.getCPtr(triple), triple); 665 } 666 667 668/** 669 * Writes the given XML start and end element name to this {@link XMLOutputStream}. 670 <p> 671 * @param name the name of the element. 672 <p> 673 * @param prefix an optional XML namespace prefix to write in front of the 674 * <code>element</code> name. (The result has the form 675 * <code><em>prefix</em>:<em>name</em></code>.) 676 <p> 677 * 678</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 679The native C++ implementation of this method defines a default argument 680value. In the documentation generated for different libSBML language 681bindings, you may or may not see corresponding arguments in the method 682declarations. For example, in Java and C#, a default argument is handled by 683declaring two separate methods, with one of them having the argument and 684the other one lacking the argument. However, the libSBML documentation will 685be <em>identical</em> for both methods. Consequently, if you are reading 686this and do not see an argument even though one is described, please look 687for descriptions of other variants of this method near where this one 688appears in the documentation. 689</dd></dl> 690 691 */ public 692 void startEndElement(String name, String prefix) { 693 libsbmlJNI.XMLOutputStream_startEndElement__SWIG_0(swigCPtr, this, name, prefix); 694 } 695 696 697/** 698 * Writes the given XML start and end element name to this {@link XMLOutputStream}. 699 <p> 700 * @param name the name of the element. 701 <p> 702 * @param prefix an optional XML namespace prefix to write in front of the 703 * <code>element</code> name. (The result has the form 704 * <code><em>prefix</em>:<em>name</em></code>.) 705 <p> 706 * 707</dl><dl class="docnote"><dt><b>Documentation note:</b></dt><dd> 708The native C++ implementation of this method defines a default argument 709value. In the documentation generated for different libSBML language 710bindings, you may or may not see corresponding arguments in the method 711declarations. For example, in Java and C#, a default argument is handled by 712declaring two separate methods, with one of them having the argument and 713the other one lacking the argument. However, the libSBML documentation will 714be <em>identical</em> for both methods. Consequently, if you are reading 715this and do not see an argument even though one is described, please look 716for descriptions of other variants of this method near where this one 717appears in the documentation. 718</dd></dl> 719 720 */ public 721 void startEndElement(String name) { 722 libsbmlJNI.XMLOutputStream_startEndElement__SWIG_1(swigCPtr, this, name); 723 } 724 725 726/** 727 * Writes the given start element to this output stream. 728 <p> 729 * @param triple the XML element to write. 730 */ public 731 void startEndElement(XMLTriple triple) { 732 libsbmlJNI.XMLOutputStream_startEndElement__SWIG_2(swigCPtr, this, XMLTriple.getCPtr(triple), triple); 733 } 734 735 736/** 737 * Writes the given attribute and value to this output stream. 738 <p> 739 * @param name the name of the attribute. 740 <p> 741 * @param value the value of the attribute. 742 */ public 743 void writeAttribute(String name, String value) { 744 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_0(swigCPtr, this, name, value); 745 } 746 747 748/** 749 * Writes the given namespace-prefixed attribute value to this output stream. 750 <p> 751 * @param name the name of the attribute. 752 <p> 753 * @param prefix an XML namespace prefix to write in front of the 754 * <code>element</code> name. (The result has the form 755 * <code><em>prefix</em>:<em>name</em></code>.) See other versions of 756 * this method for a variant that does not require a prefix. 757 <p> 758 * @param value the value of the attribute. 759 */ public 760 void writeAttribute(String name, String prefix, String value) { 761 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_1(swigCPtr, this, name, prefix, value); 762 } 763 764 765/** 766 * Writes the given attribute and value to this output stream. 767 <p> 768 * @param triple the attribute, in the form of an {@link XMLTriple}. 769 <p> 770 * @param value the value of the attribute. 771 */ public 772 void writeAttribute(XMLTriple triple, String value) { 773 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_2(swigCPtr, this, XMLTriple.getCPtr(triple), triple, value); 774 } 775 776 777/** 778 * Writes the given attribute and value to this output stream. 779 <p> 780 * @param name the name of the attribute. 781 <p> 782 * @param value the value of the attribute. 783 */ public 784 void writeAttribute(String name, boolean value) { 785 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_6(swigCPtr, this, name, value); 786 } 787 788 789/** 790 * Writes the given namespace-prefixed attribute value to this output stream. 791 <p> 792 * @param name the name of the attribute. 793 <p> 794 * @param prefix an XML namespace prefix to write in front of the 795 * <code>element</code> name. (The result has the form 796 * <code><em>prefix</em>:<em>name</em></code>.) See other versions of 797 * this method for a variant that does not require a prefix. 798 <p> 799 * @param value the value of the attribute. 800 */ public 801 void writeAttribute(String name, String prefix, boolean value) { 802 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_7(swigCPtr, this, name, prefix, value); 803 } 804 805 806/** 807 * Writes the given attribute and value to this output stream. 808 <p> 809 * @param triple the attribute, in the form of an {@link XMLTriple}. 810 <p> 811 * @param value the value of the attribute. 812 */ public 813 void writeAttribute(XMLTriple triple, boolean value) { 814 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_8(swigCPtr, this, XMLTriple.getCPtr(triple), triple, value); 815 } 816 817 818/** 819 * Writes the given attribute and value to this output stream. 820 <p> 821 * @param name the name of the attribute. 822 <p> 823 * @param value the value of the attribute. 824 */ public 825 void writeAttribute(String name, double value) { 826 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_9(swigCPtr, this, name, value); 827 } 828 829 830/** 831 * Writes the given namespace-prefixed attribute value to this output stream. 832 <p> 833 * @param name the name of the attribute. 834 <p> 835 * @param prefix an XML namespace prefix to write in front of the 836 * <code>element</code> name. (The result has the form 837 * <code><em>prefix</em>:<em>name</em></code>.) See other versions of 838 * this method for a variant that does not require a prefix. 839 <p> 840 * @param value the value of the attribute. 841 */ public 842 void writeAttribute(String name, String prefix, double value) { 843 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_10(swigCPtr, this, name, prefix, value); 844 } 845 846 847/** 848 * Writes the given attribute and value to this output stream. 849 <p> 850 * @param triple the attribute, in the form of an {@link XMLTriple}. 851 <p> 852 * @param value the value of the attribute. 853 */ public 854 void writeAttribute(XMLTriple triple, double value) { 855 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_11(swigCPtr, this, XMLTriple.getCPtr(triple), triple, value); 856 } 857 858 859/** 860 * Writes the given attribute and value to this output stream. 861 <p> 862 * @param name the name of the attribute. 863 <p> 864 * @param value the value of the attribute. 865 */ public 866 void writeAttribute(String name, int value) { 867 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_12(swigCPtr, this, name, value); 868 } 869 870 871/** 872 * Writes the given namespace-prefixed attribute value to this output stream. 873 <p> 874 * @param name the name of the attribute. 875 <p> 876 * @param prefix an XML namespace prefix to write in front of the 877 * <code>element</code> name. (The result has the form 878 * <code><em>prefix</em>:<em>name</em></code>.) See other versions of 879 * this method for a variant that does not require a prefix. 880 <p> 881 * @param value the value of the attribute. 882 */ public 883 void writeAttribute(String name, String prefix, int value) { 884 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_13(swigCPtr, this, name, prefix, value); 885 } 886 887 888/** 889 * Writes the given attribute and value to this output stream. 890 <p> 891 * @param triple the attribute, in the form of an {@link XMLTriple}. 892 <p> 893 * @param value the value of the attribute. 894 */ public 895 void writeAttribute(XMLTriple triple, int value) { 896 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_14(swigCPtr, this, XMLTriple.getCPtr(triple), triple, value); 897 } 898 899 900/** 901 * Writes the given namespace-prefixed attribute value to this output stream. 902 <p> 903 * @param name the name of the attribute. 904 <p> 905 * @param prefix an XML namespace prefix to write in front of the 906 * <code>element</code> name. (The result has the form 907 * <code><em>prefix</em>:<em>name</em></code>.) See other versions of 908 * this method for a variant that does not require a prefix. 909 <p> 910 * @param value the value of the attribute. 911 */ public 912 void writeAttribute(String name, String prefix, long value) { 913 libsbmlJNI.XMLOutputStream_writeAttribute__SWIG_18(swigCPtr, this, name, prefix, value); 914 } 915 916 917/** 918 * Writes a standard XML declaration to this output stream. 919 <p> 920 * <p> 921 * The XML declaration has the form 922 * <pre class='fragment'> 923<?xml version='1.0' encoding='UTF-8'?> 924</pre> 925 * Note that the SBML specifications require the use of UTF-8 encoding and 926 * version 1.0, so for SBML documents, the above is the standard XML 927 * declaration. 928 */ public 929 void writeXMLDecl() { 930 libsbmlJNI.XMLOutputStream_writeXMLDecl(swigCPtr, this); 931 } 932 933 934/** 935 * Writes an XML comment with the name and version of this program. 936 <p> 937 * The XML comment has the following form: 938 * <pre class='fragment'> 939<!-- Created by <program name> version <program version> 940on yyyy-MM-dd HH:mm with libSBML version <libsbml version>. --> 941</pre> 942 <p> 943 * See the class constructor for more information about this program 944 * comment. 945 <p> 946 * @param programName an optional program name to write as a comment 947 * in the output stream. 948 <p> 949 * @param programVersion an optional version identification string to write 950 * as a comment in the output stream. 951 <p> 952 * @param writeTimestamp an optional flag indicating that a timestamp should 953 * be written. 954 */ public 955 void writeComment(String programName, String programVersion, boolean writeTimestamp) { 956 libsbmlJNI.XMLOutputStream_writeComment__SWIG_0(swigCPtr, this, programName, programVersion, writeTimestamp); 957 } 958 959 960/** 961 * Writes an XML comment with the name and version of this program. 962 <p> 963 * The XML comment has the following form: 964 * <pre class='fragment'> 965<!-- Created by <program name> version <program version> 966on yyyy-MM-dd HH:mm with libSBML version <libsbml version>. --> 967</pre> 968 <p> 969 * See the class constructor for more information about this program 970 * comment. 971 <p> 972 * @param programName an optional program name to write as a comment 973 * in the output stream. 974 <p> 975 * @param programVersion an optional version identification string to write 976 * as a comment in the output stream. 977 <p> 978 * @param writeTimestamp an optional flag indicating that a timestamp should 979 * be written. 980 */ public 981 void writeComment(String programName, String programVersion) { 982 libsbmlJNI.XMLOutputStream_writeComment__SWIG_1(swigCPtr, this, programName, programVersion); 983 } 984 985 986/** 987 * Decreases the indentation level for this {@link XMLOutputStream}. 988 <p> 989 * <p> 990 * LibSBML tries to produce human-readable XML output by automatically 991 * indenting the bodies of elements. Callers can manually control 992 * indentation further by using the {@link XMLOutputStream#upIndent()} 993 * and {@link XMLOutputStream#downIndent()} methods to increase and 994 * decrease, respectively, the current level of indentation in the 995 * XML output. 996 <p> 997 * @see #upIndent() 998 */ public 999 void downIndent() { 1000 libsbmlJNI.XMLOutputStream_downIndent(swigCPtr, this); 1001 } 1002 1003 1004/** 1005 * Increases the indentation level for this {@link XMLOutputStream}. 1006 <p> 1007 * <p> 1008 * LibSBML tries to produce human-readable XML output by automatically 1009 * indenting the bodies of elements. Callers can manually control 1010 * indentation further by using the {@link XMLOutputStream#upIndent()} 1011 * and {@link XMLOutputStream#downIndent()} methods to increase and 1012 * decrease, respectively, the current level of indentation in the 1013 * XML output. 1014 <p> 1015 * @see #downIndent() 1016 */ public 1017 void upIndent() { 1018 libsbmlJNI.XMLOutputStream_upIndent(swigCPtr, this); 1019 } 1020 1021 1022/** 1023 * Returns the {@link SBMLNamespaces} object attached to this output stream. 1024 <p> 1025 * @return the {@link SBMLNamespaces} object, or <code>null</code> if none has been set. 1026 */ public 1027 SBMLNamespaces getSBMLNamespaces() { 1028 return libsbml.DowncastSBMLNamespaces(libsbmlJNI.XMLOutputStream_getSBMLNamespaces(swigCPtr, this), false); 1029} 1030 1031 1032/** 1033 * Sets the {@link SBMLNamespaces} object associated with this output stream. 1034 <p> 1035 * @param sbmlns the namespace object. 1036 */ public 1037 void setSBMLNamespaces(SBMLNamespaces sbmlns) { 1038 libsbmlJNI.XMLOutputStream_setSBMLNamespaces(swigCPtr, this, SBMLNamespaces.getCPtr(sbmlns), sbmlns); 1039 } 1040 1041 1042/** 1043 * @return a boolean, whether the output stream will write an XML 1044 * comment at the top of the file. (Enabled by default.) 1045 */ public 1046 static boolean getWriteComment() { 1047 return libsbmlJNI.XMLOutputStream_getWriteComment(); 1048 } 1049 1050 1051/** 1052 * sets a flag, whether the output stream will write an XML 1053 * comment at the top of the file. (Enabled by default.) 1054 <p> 1055 * @param writeComment the flag. 1056 */ public 1057 static void setWriteComment(boolean writeComment) { 1058 libsbmlJNI.XMLOutputStream_setWriteComment(writeComment); 1059 } 1060 1061 1062/** 1063 * @return a boolean, whether the output stream will write an XML 1064 * comment with a timestamp at the top of the file. (Enabled by default.) 1065 */ public 1066 static boolean getWriteTimestamp() { 1067 return libsbmlJNI.XMLOutputStream_getWriteTimestamp(); 1068 } 1069 1070 1071/** 1072 * sets a flag, whether the output stream will write an XML 1073 * comment with a timestamp at the top of the file. (Enabled by default.) 1074 <p> 1075 * @param writeTimestamp the flag. 1076 */ public 1077 static void setWriteTimestamp(boolean writeTimestamp) { 1078 libsbmlJNI.XMLOutputStream_setWriteTimestamp(writeTimestamp); 1079 } 1080 1081 1082/** 1083 * @return the name of the library to be used in comments ('libSBML' by default). 1084 */ public 1085 static String getLibraryName() { 1086 return libsbmlJNI.XMLOutputStream_getLibraryName(); 1087 } 1088 1089 1090/** 1091 * sets the name of the library writing the XML 1092<p> 1093 * @param libraryName the name of the library to be used in comments. 1094 */ public 1095 static void setLibraryName(String libraryName) { 1096 libsbmlJNI.XMLOutputStream_setLibraryName(libraryName); 1097 } 1098 1099 1100/** 1101 * @return a string representing the version of the library writing the output. 1102 * This is the value of getLibSBMLDottedVersion() by default. 1103 */ public 1104 static String getLibraryVersion() { 1105 return libsbmlJNI.XMLOutputStream_getLibraryVersion(); 1106 } 1107 1108 1109/** 1110 * sets the name of the library writing the output 1111 <p> 1112 * @param libraryVersion the version information as string. 1113 */ public 1114 static void setLibraryVersion(String libraryVersion) { 1115 libsbmlJNI.XMLOutputStream_setLibraryVersion(libraryVersion); 1116 } 1117 1118 1119/** * @internal */ public 1120 long getIndent() { 1121 return libsbmlJNI.XMLOutputStream_getIndent(swigCPtr, this); 1122 } 1123 1124 1125/** * @internal */ public 1126 void setIndent(long indent) { 1127 libsbmlJNI.XMLOutputStream_setIndent(swigCPtr, this, indent); 1128 } 1129 1130}