Example #1
0
        /// <summary>
        /// Initializes a new instance of the PbfWriter class that writes entities to specified file with given settings.
        /// </summary>
        /// <param name="filename">Path to the file to write entities to.</param>
        /// <param name="settings">The settings defining behaviour of the writer.</param>
        public PbfWriter(string filename, PbfWriterSettings settings)
        {
            this.Settings            = settings;
            this.Settings.IsReadOnly = true;
            _output           = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite);
            _ownsOutputStream = true;

            this.InitializeBuffers();
            this.WriteHeader();
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the PbfWriter class that writes entities to specified stream with given settings.
        /// </summary>
        /// <param name="stream">The stream to write entities to.</param>
        /// <param name="settings">The settings defining behaviour of the writer.</param>
        public PbfWriter(Stream stream, PbfWriterSettings settings)
        {
            this.Settings            = settings;
            this.Settings.IsReadOnly = true;
            _output           = stream;
            _ownsOutputStream = false;

            this.InitializeBuffers();
            this.WriteHeader();
        }