org.sbml.jsbml
public class SBMLWriter extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
This SBMLWriter
is just a wrapper for the actual implementation in
SBMLWriter
.
This class is provided for compatibility with libSBML and to avoid problems
if the internal of jsbml change, so it is preferable to use it instead of
directly using SBMLWriter
. The
SBMLWriter
class is the converse of SBMLReader
, and provides
the main interface for serializing SBML models into XML and writing the
result to files and text strings. The methods for writing SBML all take an
SBMLDocument
object and a destination.
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
programName
The name of the program that has been used to create an SBML
String representation (possibly in a File ) with the help
of JSBML. |
private java.lang.String |
programVersion
The version of the program using JSBML to serialize a model in an SBML
String or File . |
private SBMLWriter |
sbmlWriter
The actual writer.
|
private static long |
serialVersionUID
Generated serial version identifier.
|
Constructor and Description |
---|
SBMLWriter()
Creates a new
SBMLwriter . |
SBMLWriter(char indentChar,
short indentCount)
Creates a new
SBMLwriter that uses the given character for
indentation of the XML representation of SBML data structures (with the
given number of such symbols). |
SBMLWriter(SBMLWriter sbmlWriter)
Clone constructor.
|
SBMLWriter(java.lang.String programName,
java.lang.String programVersion)
Creates a new
SBMLwriter for the program with the given name and
version. |
SBMLWriter(java.lang.String programName,
java.lang.String programVersion,
char indentChar,
short indentCount)
Creates a new
SBMLwriter for the program with the given name and
version that uses the given character for indentation of the XML
representation of SBML data structures (with the given number of such
symbols). |
Modifier and Type | Method and Description |
---|---|
SBMLWriter |
clone() |
boolean |
equals(java.lang.Object o) |
char |
getIndentationChar()
Gives the symbol that is used to indent the SBML output for a better
structure and to improve human-readability.
|
short |
getIndentationCount()
Gives the number of indent symbols that are inserted in a line to better
structure the SBML output.
|
java.lang.String |
getProgramName() |
java.lang.String |
getProgramVersion() |
boolean |
isSetProgramName()
Check if a program name has been defined for this
SBMLWriter . |
boolean |
isSetProgramVersion()
Check if a program version has been defined for this
SBMLWriter . |
void |
setIndentationChar(char indentChar)
Influences the way how SBML data structures are represented in XML.
|
void |
setIndentationCount(short indentCount)
Influences the way how SBML data structures are represented in XML.
|
int |
setProgramName(java.lang.String name)
Sets the name of this program, i.e., the program that is about to
write out the
SBMLDocument . |
int |
setProgramVersion(java.lang.String version)
Sets the version of this program, i.e., the program that is about to
write out the
SBMLDocument . |
java.lang.String |
toString() |
void |
unsetProgramName() |
void |
unsetProgramVersion() |
void |
write(SBMLDocument sbmlDocument,
java.io.File file)
Writes the given SBML document to a
File . |
static void |
write(SBMLDocument sbmlDocument,
java.io.File file,
char indentChar,
short indentCount)
Writes the given SBML document to a
File . |
static void |
write(SBMLDocument sbmlDocument,
java.io.File file,
java.lang.String programName,
java.lang.String programVersion)
Writes the given SBML document to a
File . |
static void |
write(SBMLDocument sbmlDocument,
java.io.File file,
java.lang.String programName,
java.lang.String programVersion,
char indentChar,
short indentCount)
Writes the given SBML document to a
File . |
void |
write(SBMLDocument sbmlDocument,
java.io.OutputStream stream)
Writes the given SBML document to the
OutputStream . |
static void |
write(SBMLDocument sbmlDocument,
java.io.OutputStream stream,
char indentChar,
short indentCount)
Writes the given
SBMLDocument to the OutputStream . |
static void |
write(SBMLDocument sbmlDocument,
java.io.OutputStream stream,
java.lang.String programName,
java.lang.String programVersion)
Writes the given
SBMLDocument to the OutputStream . |
static void |
write(SBMLDocument sbmlDocument,
java.io.OutputStream stream,
java.lang.String programName,
java.lang.String programVersion,
char indentChar,
short indentCount)
Writes the given
SBMLDocument to the OutputStream . |
void |
write(SBMLDocument sbmlDocument,
java.lang.String fileName)
Writes the given
SBMLDocument to file name. |
static void |
write(SBMLDocument sbmlDocument,
java.lang.String fileName,
char indentChar,
short indentCount)
Writes the given
SBMLDocument to file name. |
static void |
write(SBMLDocument sbmlDocument,
java.lang.String fileName,
java.lang.String programName,
java.lang.String programVersion)
Writes the given
SBMLDocument to file name. |
static void |
write(SBMLDocument sbmlDocument,
java.lang.String fileName,
java.lang.String programName,
java.lang.String programVersion,
char indentChar,
short indentCount)
Writes the given
SBMLDocument to file name. |
void |
writeSBML(SBMLDocument sbmlDocument,
java.io.File file)
Writes the given SBML document to a
File . |
void |
writeSBMLToFile(SBMLDocument sbmlDocument,
java.lang.String fileName)
Writes the given SBML document to file name.
|
java.lang.String |
writeSBMLToString(SBMLDocument sbmlDocument)
Writes the given SBML document to an in-memory
String and returns
it. |
private static final long serialVersionUID
private java.lang.String programName
String
representation (possibly in a File
) with the help
of JSBML.private java.lang.String programVersion
String
or File
.private SBMLWriter sbmlWriter
public SBMLWriter()
SBMLwriter
.public SBMLWriter(char indentChar, short indentCount)
SBMLwriter
that uses the given character for
indentation of the XML representation of SBML data structures (with the
given number of such symbols).indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.indentCount
- The number of indentation characters.public SBMLWriter(SBMLWriter sbmlWriter)
sbmlWriter
- public SBMLWriter(java.lang.String programName, java.lang.String programVersion)
SBMLwriter
for the program with the given name and
version.programName
- The name of the program that has been used to create an SBML
String
representation (possibly in a File
)
with the help of JSBML.programVersion
- The version of the program using JSBML to serialize a model in
an SBML String
or File
.public SBMLWriter(java.lang.String programName, java.lang.String programVersion, char indentChar, short indentCount)
SBMLwriter
for the program with the given name and
version that uses the given character for indentation of the XML
representation of SBML data structures (with the given number of such
symbols).programName
- The name of the program that has been used to create an SBML
String
representation (possibly in a File
)
with the help of JSBML.programVersion
- The version of the program using JSBML to serialize a model in
an SBML String
or File
.indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.indentCount
- The number of indentation characters.public static void write(SBMLDocument sbmlDocument, java.io.File file, char indentChar, short indentCount) throws javax.xml.stream.XMLStreamException, SBMLException, java.io.IOException
File
.sbmlDocument
- the SBMLDocument
to be writtenfile
- the file where the SBML document is to be written.indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.indentCount
- The number of indentation characters.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.java.io.IOException
- if it is not possible to write to the given file, e.g., due
to an invalid file name or missing permissions.public static void write(SBMLDocument sbmlDocument, java.io.File file, java.lang.String programName, java.lang.String programVersion) throws javax.xml.stream.XMLStreamException, SBMLException, java.io.IOException
File
.
sbmlDocument
- the SBMLDocument
to be writtenfile
- the file where the SBML document is to be written.programName
- the name of this program (where 'this program' refers to the
program in which JSBML is embedded, not JSBML itself!)programVersion
- the version of this program (where 'this program' refers to
the program in which JSBML is embedded, not JSBML itself!)javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.java.io.IOException
- if it is not possible to write to the given file, e.g., due
to an invalid file name or missing permissions.public static void write(SBMLDocument sbmlDocument, java.io.File file, java.lang.String programName, java.lang.String programVersion, char indentChar, short indentCount) throws javax.xml.stream.XMLStreamException, SBMLException, java.io.IOException
File
.
sbmlDocument
- the SBMLDocument
to be writtenfile
- the file where the SBML document is to be written.programName
- the name of this program (where 'this program' refers to the
program in which JSBML is embedded, not JSBML itself!)programVersion
- the version of this program (where 'this program' refers to
the program in which JSBML is embedded, not JSBML itself!)indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.indentCount
- The number of indentation characters.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.java.io.IOException
- if it is not possible to write to the given file, e.g., due
to an invalid file name or missing permissions.#write(SBMLDocument, File, String, String)}
public static void write(SBMLDocument sbmlDocument, java.io.OutputStream stream, char indentChar, short indentCount) throws javax.xml.stream.XMLStreamException, SBMLException
SBMLDocument
to the OutputStream
.sbmlDocument
- the SBML document to be writtenstream
- the stream object where the SBML is to be written.indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.indentCount
- The number of indentation characters.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.public static void write(SBMLDocument sbmlDocument, java.io.OutputStream stream, java.lang.String programName, java.lang.String programVersion) throws javax.xml.stream.XMLStreamException, SBMLException
SBMLDocument
to the OutputStream
.sbmlDocument
- the SBML document to be writtenstream
- the stream object where the SBML is to be written.programName
- the name of this program (where 'this program' refers to the
program in which JSBML is embedded, not JSBML itself!)programVersion
- the version of this program (where 'this program' refers to
the program in which JSBML is embedded, not JSBML itself!)javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.public static void write(SBMLDocument sbmlDocument, java.io.OutputStream stream, java.lang.String programName, java.lang.String programVersion, char indentChar, short indentCount) throws javax.xml.stream.XMLStreamException, SBMLException
SBMLDocument
to the OutputStream
.sbmlDocument
- the SBML document to be writtenstream
- the stream object where the SBML is to be written.programName
- the name of this program (where 'this program' refers to the
program in which JSBML is embedded, not JSBML itself!)programVersion
- the version of this program (where 'this program' refers to
the program in which JSBML is embedded, not JSBML itself!)indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.indentCount
- The number of indentation characters.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.write(SBMLDocument, OutputStream, String, String)
public static void write(SBMLDocument sbmlDocument, java.lang.String fileName, char indentChar, short indentCount) throws javax.xml.stream.XMLStreamException, java.io.FileNotFoundException, SBMLException
SBMLDocument
to file name.sbmlDocument
- the SBMLDocument
to be writtenfileName
- the name or full pathname of the file where the SBML document
is to be written.indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.indentCount
- The number of indentation characters.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.java.io.FileNotFoundException
- if the file does not exist or cannot be created.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.public static void write(SBMLDocument sbmlDocument, java.lang.String fileName, java.lang.String programName, java.lang.String programVersion) throws javax.xml.stream.XMLStreamException, java.io.FileNotFoundException, SBMLException
SBMLDocument
to file name.
sbmlDocument
- the SBMLDocument
to be writtenfileName
- the name or full pathname of the file where the SBML document
is to be written.programName
- the name of this program (where 'this program' refers to the
program in which JSBML is embedded, not JSBML itself!)programVersion
- the version of this program (where 'this program' refers to
the program in which JSBML is embedded, not JSBML itself!)java.io.FileNotFoundException
- if the file does not exist or cannot be created.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.public static void write(SBMLDocument sbmlDocument, java.lang.String fileName, java.lang.String programName, java.lang.String programVersion, char indentChar, short indentCount) throws javax.xml.stream.XMLStreamException, java.io.FileNotFoundException, SBMLException
SBMLDocument
to file name.
sbmlDocument
- the SBMLDocument
to be writtenfileName
- the name or full pathname of the file where the SBML document
is to be written.programName
- the name of this program (where 'this program' refers to the
program in which JSBML is embedded, not JSBML itself!)programVersion
- the version of this program (where 'this program' refers to
the program in which JSBML is embedded, not JSBML itself!)indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.indentCount
- The number of indentation characters.java.io.FileNotFoundException
- if the file does not exist or cannot be created.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.write(SBMLDocument, String, String, String)
public SBMLWriter clone()
clone
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public char getIndentationChar()
public short getIndentationCount()
public java.lang.String getProgramName()
setProgramName(String)
public java.lang.String getProgramVersion()
setProgramVersion(String)
public boolean isSetProgramName()
SBMLWriter
.public boolean isSetProgramVersion()
SBMLWriter
.public void setIndentationChar(char indentChar)
indentChar
- The symbol to be used to indent new blocks within an XML
representation of SBML data structures.public void setIndentationCount(short indentCount)
indentCount
- The number of indentation characters in the XML representation
of SBML data structures.public int setProgramName(java.lang.String name)
SBMLDocument
.
If the program name and version are set (see
setProgramVersion(String version)
), the
following XML comment, intended for human consumption, will be written
at the beginning of the document:
name
- the name of this program (where 'this program' refers to
the program in which JSBML is embedded, not JSBML itself!)
JSBML.OPERATION_SUCCESS
setProgramVersion(String version)
public int setProgramVersion(java.lang.String version)
SBMLDocument
.
If the program version and name are set (see
setProgramName(String name)
), the
following XML comment, intended for human consumption, will be written
at the beginning of the document:
version
- the version of this program (where 'this program'
refers to the program in which JSBML is embedded, not JSBML itself!)
JSBML.OPERATION_SUCCESS
setProgramName(String name)
public java.lang.String toString()
toString
in class java.lang.Object
public void unsetProgramName()
public void unsetProgramVersion()
public void write(SBMLDocument sbmlDocument, java.io.File file) throws javax.xml.stream.XMLStreamException, SBMLException, java.io.IOException
File
. If specified in the
constructor of this SBMLWriter
, the programName
and
programVersion
of the calling program will be made persistent in
the resulting SBML File
.sbmlDocument
- the SBMLDocument
to be writtenfile
- the file where the SBML document is to be written.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.java.io.IOException
- if it is not possible to write to the given file, e.g., due
to an invalid file name or missing permissions.public void write(SBMLDocument sbmlDocument, java.io.OutputStream stream) throws javax.xml.stream.XMLStreamException, SBMLException
OutputStream
. If specified
in the constructor of this SBMLWriter
, the programName
and programVersion
of the calling program will be made
persistent in the resulting SBML representation.sbmlDocument
- the SBML document to be writtenstream
- the stream object where the SBML is to be written.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.public void write(SBMLDocument sbmlDocument, java.lang.String fileName) throws javax.xml.stream.XMLStreamException, java.io.FileNotFoundException, SBMLException
SBMLDocument
to file name. If specified in the
constructor of this SBMLWriter
, the programName
and
programVersion
of the calling program will be made persistent in
the resulting SBML File
.
sbmlDocument
- the SBMLDocument
to be writtenfileName
- the name or full pathname of the file where the SBML document
is to be written.
java.io.FileNotFoundException
- if the file does not exist or cannot be created.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.public void writeSBML(SBMLDocument sbmlDocument, java.io.File file) throws javax.xml.stream.XMLStreamException, SBMLException, java.io.IOException
File
. If specified in the
constructor of this SBMLWriter
, the programName
and
programVersion
of the calling program will be made persistent in
the resulting SBML File
.sbmlDocument
- the SBML document to be writtenfile
- the file where the SBML document is to be written.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.java.io.IOException
- if it is not possible to write to the given file, e.g., due
to an invalid file name or missing permissions.public void writeSBMLToFile(SBMLDocument sbmlDocument, java.lang.String fileName) throws java.io.FileNotFoundException, javax.xml.stream.XMLStreamException, SBMLException
SBMLWriter
, the programName
and
programVersion
of the calling program will be made persistent in
the resulting SBML File
.
sbmlDocument
- the SBML document to be writtenfileName
- the name or full pathname of the file where the SBML document
is to be written.java.io.FileNotFoundException
- if the file does not exist or cannot be created.javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.public java.lang.String writeSBMLToString(SBMLDocument sbmlDocument) throws javax.xml.stream.XMLStreamException, SBMLException
String
and returns
it. If specified in the constructor of this SBMLWriter
, the
programName
and programVersion
of the calling program
will be made persistent in the resulting SBML String
.
sbmlDocument
- the SBML document to be written
javax.xml.stream.XMLStreamException
- if any problems prevent to write the SBMLDocument
as
XML.SBMLException
- if any SBML problems prevent to write the
SBMLDocument
.