//----------------------------------------------------------------------------- // importIntoDocument //----------------------------------------------------------------------------- /// <summary> /// Imports an XML fragment into a document. The import requires /// an update transaction. /// </summary> /// <param name="istream"> /// Input stream containing the nodes to be imported. /// </param> /// <param name="nodeToLinkTo"> /// Existing node that imported nodes will link to. /// </param> /// <param name="insertLocation"> /// Where imported XML fragment is to be linked with respect /// to nodeToLinkTo. /// </param> /// <returns> /// Returns import statistics <see cref="CS_XFLM_IMPORT_STATS"/>. /// </returns> public CS_XFLM_IMPORT_STATS importIntoDocument( IStream istream, DOMNode nodeToLinkTo, eNodeInsertLoc insertLocation) { RCODE rc; CS_XFLM_IMPORT_STATS importStats = new CS_XFLM_IMPORT_STATS(); if ((rc = xflaim_Db_importIntoDocument( m_pDb, istream.getIStream(), nodeToLinkTo.getNode(), insertLocation, importStats)) != 0) { throw new XFlaimException(rc); } return( importStats); }
//----------------------------------------------------------------------------- // importDocument //----------------------------------------------------------------------------- /// <summary> /// Imports an XML document into the XFlaim database. The import requires /// an update transaction. /// </summary> /// <param name="istream"> /// Input stream containing the document(s) to be imported /// </param> /// <param name="uiCollection"> /// Destination collection for imported document(s). /// </param> /// <param name="nodeToReuse"> /// An existing DOM node object can optionally be passed in. It will /// be reused rather than allocating a new object. /// </param> /// <param name="importStats"> /// Import statistics is returned here if a non-null value is passed in. /// </param> /// <returns> /// Returns a <see cref="DOMNode"/> that is the root of the imported document. /// </returns> public DOMNode importDocument( IStream istream, uint uiCollection, DOMNode nodeToReuse, CS_XFLM_IMPORT_STATS importStats) { RCODE rc; IntPtr pDocumentNode = (nodeToReuse != null) ? nodeToReuse.getNode() : IntPtr.Zero; if (importStats == null) { importStats = new CS_XFLM_IMPORT_STATS(); } if ((rc = xflaim_Db_importDocument( m_pDb, istream.getIStream(), uiCollection, ref pDocumentNode, importStats)) != 0) { throw new XFlaimException(rc); } if( nodeToReuse != null) { nodeToReuse.setNodePtr( pDocumentNode, this); return( nodeToReuse); } return( new DOMNode( pDocumentNode, this)); }
//----------------------------------------------------------------------------- // writeToOStream //----------------------------------------------------------------------------- /// <summary> /// Read data from an input stream and write it out to an output stream. This /// is a quick way to copy all data from an input stream to an output stream. /// </summary> /// <param name="istream"> /// Input stream data is to be read from. /// </param> /// <param name="ostream"> /// Output stream data is to be written to. /// </param> public void writeToOStream( IStream istream, OStream ostream) { RCODE rc; if ((rc = xflaim_DbSystem_writeToOStream( m_pDbSystem, istream.getIStream(), ostream.getOStream())) != 0) { throw new XFlaimException( rc); } }
//----------------------------------------------------------------------------- // openUncompressingIStream //----------------------------------------------------------------------------- /// <summary> /// Open an input stream that decompresses data from another input stream. It /// is assumed that data coming out of the other input stream is compressed. /// </summary> /// <param name="inputIStream"> /// Input stream whose data is to be decompressed. /// </param> /// <returns> /// Returns an <see cref="IStream"/> object that can then be passed to /// methods which require an IStream object. /// </returns> public IStream openUncompressingIStream( IStream inputIStream) { RCODE rc; IntPtr pIStream = IntPtr.Zero; if ((rc = xflaim_DbSystem_openUncompressingIStream( m_pDbSystem, inputIStream.getIStream(), out pIStream)) != 0) { throw new XFlaimException( rc); } return( new IStream( pIStream, this)); }
//----------------------------------------------------------------------------- // openBufferedIStream //----------------------------------------------------------------------------- /// <summary> /// Open an input stream that buffers an existing input stream. /// </summary> /// <param name="inputIStream"> /// Input stream that is to be buffered. /// </param> /// <param name="uiBufferSize"> /// iBufferSize The size (in bytes) of the buffer to use for the /// input stream. Data will be read into the buffer in chunks of this size. /// This will help performance by preventing lots of smaller reads from /// the original input stream. /// </param> /// <returns> /// Returns an <see cref="IStream"/> object that can then be passed to /// methods which require an IStream object. /// </returns> public IStream openBufferedIStream( IStream inputIStream, uint uiBufferSize) { RCODE rc; IntPtr pIStream = IntPtr.Zero; if ((rc = xflaim_DbSystem_openBufferedIStream( m_pDbSystem, inputIStream.getIStream(), uiBufferSize, out pIStream)) != 0) { throw new XFlaimException( rc); } return( new IStream( pIStream, this)); }
//----------------------------------------------------------------------------- // openBase64Encoder //----------------------------------------------------------------------------- /// <summary> /// Open an input stream that encodes data from another input stream into /// base 64 encoded binary. Data read from the stream object returned by /// this method will be base 64 encoded. /// </summary> /// <param name="inputIStream"> /// Input stream whose data is to be base 64 encoded. /// </param> /// <param name="bInsertLineBreaks"> /// Flag indicating whether or not line breaks /// should be inserted into the data as it is base 64 encoded. /// </param> /// <returns> /// Returns an <see cref="IStream"/> object that can then be passed to /// methods which require an IStream object. /// </returns> public IStream openBase64Encoder( IStream inputIStream, bool bInsertLineBreaks) { RCODE rc; IntPtr pIStream = IntPtr.Zero; if ((rc = xflaim_DbSystem_openBase64Encoder( m_pDbSystem, inputIStream.getIStream(), (int)(bInsertLineBreaks ? 1 : 0), out pIStream)) != 0) { throw new XFlaimException( rc); } return( new IStream( pIStream, this)); }