/// <summary> /// Formats the given object array into an embedded record. /// </summary> /// <param name="value">The object array containing the values of the embedded record.</param> /// <returns>A formatted string containing the embedded data.</returns> public override string Format(object value) { object[] values = value as object[]; if (values == null) { return(NullHandler.GetNullRepresentation()); } StringWriter writer = new StringWriter(); FixedLengthRecordWriter recordWriter = new FixedLengthRecordWriter(writer, schema, options); recordWriter.WriteRecord(values); return(writer.ToString()); }
/// <summary> /// Initializes a new FixedLengthBuilder with the given schema. /// </summary> /// <param name="writer">A writer over the fixed-length document.</param> /// <param name="schema">The schema of the fixed-length document.</param> /// <param name="options">The options used to format the output.</param> /// <exception cref="ArgumentNullException">The writer is null.</exception> /// <exception cref="ArgumentNullException">The schema is null.</exception> public FixedLengthWriter(TextWriter writer, FixedLengthSchema schema, FixedLengthOptions options = null) { if (writer == null) { throw new ArgumentNullException("writer"); } if (schema == null) { throw new ArgumentNullException("schema"); } if (options == null) { options = new FixedLengthOptions(); } this.recordWriter = new FixedLengthRecordWriter(writer, schema, options); this.isFirstLine = true; }