001/* ---------------------------------------------------------------------------- 002 * This file was automatically generated by SWIG (http://www.swig.org). 003 * Version 2.0.11 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 * Wrapper class for the C++ standard file stream <code>ofstream</code>. 013 * <p> 014 * The C++ <code>ofstream</code> ('output file stream') provides an 015 * interface for writing data to files as output streams. This class, 016 * {@link OFStream}, wraps the C++ <code>ofstream</code> and provides an {@link OStream} 017 * interface to it. The file to be associated with the stream can be 018 * specified as a parameter to the constructors in this class. 019 * <p> 020 * This class may be useful because some libSBML methods accept an argument 021 * for indicating where to send text string output. An example is the 022 * {@link SBMLDocument#printErrors(OStream stream)} method. The methods use C++ style streams 023 * and not Java stream objects. The {@link OStream} object exists to bridge the 024 * Java and underlying native implementation. It is a simple wrapper 025 * around the underlying stream object and provides a few basic methods for 026 * manipulating it. 027 * <p> 028 */ 029 030public class OFStream extends OStream { 031 private long swigCPtr; 032 033 protected OFStream(long cPtr, boolean cMemoryOwn) 034 { 035 super(libsbmlJNI.OFStream_SWIGUpcast(cPtr), cMemoryOwn); 036 swigCPtr = cPtr; 037 } 038 039 protected static long getCPtr(OFStream obj) 040 { 041 return (obj == null) ? 0 : obj.swigCPtr; 042 } 043 044 protected static long getCPtrAndDisown (OFStream obj) 045 { 046 long ptr = 0; 047 048 if (obj != null) 049 { 050 ptr = obj.swigCPtr; 051 obj.swigCMemOwn = false; 052 } 053 054 return ptr; 055 } 056 057 protected void finalize() { 058 delete(); 059 } 060 061 public synchronized void delete() { 062 if (swigCPtr != 0) { 063 if (swigCMemOwn) { 064 swigCMemOwn = false; 065 libsbmlJNI.delete_OFStream(swigCPtr); 066 } 067 swigCPtr = 0; 068 } 069 super.delete(); 070 } 071 072 073/** 074 * Creates a new {@link OFStream} object for a file. 075 * <p> 076 * This opens the given file <code>filename</code> with the <code>is_append</code> flag 077 * (default is <code>false</code>), and creates an {@link OFStream} object 078 * instance that associates the file's content with an {@link OStream} object. 079 * <p> 080 * @param filename the name of the file to open 081 * @param is_append whether to open the file for appending (default: 082 * <code>false</code>, meaning overwrite the content instead) 083 * <p> 084 * <!-- Don't remove the leading </dl> below. It's a hack for javadoc. --> 085</dl><dl class='docnote'><dt><b>Documentation note:</b></dt><dd> 086The native C++ implementation of this method defines a default argument 087value. In the documentation generated for different libSBML language 088bindings, you may or may not see corresponding arguments in the method 089declarations. For example, in Java and C#, a default argument is handled by 090declaring two separate methods, with one of them having the argument and 091the other one lacking the argument. However, the libSBML documentation will 092be <em>identical</em> for both methods. Consequently, if you are reading 093this and do not see an argument even though one is described, please look 094for descriptions of other variants of this method near where this one 095appears in the documentation. 096</dd></dl> 097 098 */ public 099 OFStream(String filename, boolean is_append) { 100 this(libsbmlJNI.new_OFStream__SWIG_0(libsbml.getAbsolutePath(filename), is_append), true); 101 } 102 103 104/** 105 * Creates a new {@link OFStream} object for a file. 106 * <p> 107 * This opens the given file <code>filename</code> with the <code>is_append</code> flag 108 * (default is <code>false</code>), and creates an {@link OFStream} object 109 * instance that associates the file's content with an {@link OStream} object. 110 * <p> 111 * @param filename the name of the file to open 112 * @param is_append whether to open the file for appending (default: 113 * <code>false</code>, meaning overwrite the content instead) 114 * <p> 115 * <!-- Don't remove the leading </dl> below. It's a hack for javadoc. --> 116</dl><dl class='docnote'><dt><b>Documentation note:</b></dt><dd> 117The native C++ implementation of this method defines a default argument 118value. In the documentation generated for different libSBML language 119bindings, you may or may not see corresponding arguments in the method 120declarations. For example, in Java and C#, a default argument is handled by 121declaring two separate methods, with one of them having the argument and 122the other one lacking the argument. However, the libSBML documentation will 123be <em>identical</em> for both methods. Consequently, if you are reading 124this and do not see an argument even though one is described, please look 125for descriptions of other variants of this method near where this one 126appears in the documentation. 127</dd></dl> 128 129 */ public 130 OFStream(String filename) { 131 this(libsbmlJNI.new_OFStream__SWIG_1(libsbml.getAbsolutePath(filename)), true); 132 } 133 134 135/** 136 * Opens a file and associates this stream object with it. 137 * <p> 138 * This method opens a given file <code>filename</code> with the given 139 * <code>is_append</code> flag (whose default value is <code>false</code>), 140 * and associates <i>this</i> stream object with the file's content. 141 * <p> 142 * @param filename the name of the file to open 143 * @param is_append whether to open the file for appending (default: 144 * <code>false</code>, meaning overwrite the content instead) 145 * <p> 146 * <!-- Don't remove the leading </dl> below. It's a hack for javadoc. --> 147</dl><dl class='docnote'><dt><b>Documentation note:</b></dt><dd> 148The native C++ implementation of this method defines a default argument 149value. In the documentation generated for different libSBML language 150bindings, you may or may not see corresponding arguments in the method 151declarations. For example, in Java and C#, a default argument is handled by 152declaring two separate methods, with one of them having the argument and 153the other one lacking the argument. However, the libSBML documentation will 154be <em>identical</em> for both methods. Consequently, if you are reading 155this and do not see an argument even though one is described, please look 156for descriptions of other variants of this method near where this one 157appears in the documentation. 158</dd></dl> 159 160 */ public 161 void open(String filename, boolean is_append) { 162 libsbmlJNI.OFStream_open__SWIG_0(swigCPtr, this, libsbml.getAbsolutePath(filename), is_append); 163 } 164 165 166/** 167 * Opens a file and associates this stream object with it. 168 * <p> 169 * This method opens a given file <code>filename</code> with the given 170 * <code>is_append</code> flag (whose default value is <code>false</code>), 171 * and associates <i>this</i> stream object with the file's content. 172 * <p> 173 * @param filename the name of the file to open 174 * @param is_append whether to open the file for appending (default: 175 * <code>false</code>, meaning overwrite the content instead) 176 * <p> 177 * <!-- Don't remove the leading </dl> below. It's a hack for javadoc. --> 178</dl><dl class='docnote'><dt><b>Documentation note:</b></dt><dd> 179The native C++ implementation of this method defines a default argument 180value. In the documentation generated for different libSBML language 181bindings, you may or may not see corresponding arguments in the method 182declarations. For example, in Java and C#, a default argument is handled by 183declaring two separate methods, with one of them having the argument and 184the other one lacking the argument. However, the libSBML documentation will 185be <em>identical</em> for both methods. Consequently, if you are reading 186this and do not see an argument even though one is described, please look 187for descriptions of other variants of this method near where this one 188appears in the documentation. 189</dd></dl> 190 191 */ public 192 void open(String filename) { 193 libsbmlJNI.OFStream_open__SWIG_1(swigCPtr, this, libsbml.getAbsolutePath(filename)); 194 } 195 196 197/** 198 * Closes the file currently associated with this stream object. 199 */ public 200 void close() { 201 libsbmlJNI.OFStream_close(swigCPtr, this); 202 } 203 204 205/** 206 * Returns <code>true</code> if this stream object is currently 207 * associated with a file. 208 * <p> 209 * @return <code>true</code> if the stream object is currently 210 * associated with a file, <code>false</code> otherwise 211 */ public 212 boolean is_open() { 213 return libsbmlJNI.OFStream_is_open(swigCPtr, this); 214 } 215 216}