private void PrepareFile(bool append) { if (append) { if (!Stream.CanSeek) { throw new IOException("destination stream must be seekable for append operations."); } ValidateFile(); Thrift.FileMetaData fileMeta = ReadMetadata(); _footer = new ThriftFooter(fileMeta); ValidateSchemasCompatible(_footer, _schema); GoBeforeFooter(); } else { if (_footer == null) { _footer = new ThriftFooter(_schema, 0 /* todo: don't forget to set the total row count at the end!!! */); //file starts with magic WriteMagic(); } else { ValidateSchemasCompatible(_footer, _schema); _footer.Add(0 /* todo: don't forget to set the total row count at the end!!! */); } } }
void PrepareFile(DataSet ds, bool append) { if (append) { if (!Stream.CanSeek) { throw new IOException("destination stream must be seekable for append operations."); } ValidateFile(); Thrift.FileMetaData fileMeta = ReadMetadata(); _footer = new ThriftFooter(fileMeta); ValidateSchemasCompatible(_footer, ds); GoBeforeFooter(); } else { if (_footer == null) { _footer = new ThriftFooter(ds.Schema, ds.RowCount); //file starts with magic WriteMagic(); } else { ValidateSchemasCompatible(_footer, ds); _footer.Add(ds.RowCount); } } }