// Path: fixb/src/main/java/org/fixb/FixConstants.java
// public static final int BEGIN_STRING_TAG = 8;
// 
// Path: fixb/src/main/java/org/fixb/FixConstants.java
// public static final int MSG_TYPE_TAG = 35;


import static org.fixb.FixConstants.BEGIN_STRING_TAG;
import static org.fixb.FixConstants.MSG_TYPE_TAG;
import com.google.common.collect.ImmutableMap;
import org.fixb.meta.*;
import quickfix.ConfigError;
import quickfix.DataDictionary;
import quickfix.FixVersions;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.StringWriter;
import java.util.LinkedHashMap;
import java.util.Map;

        } catch (XMLStreamException e) {
            e.printStackTrace();
        }
        return new ByteArrayInputStream(stream.toString().getBytes());
    }

    private static void addStandardHeaderAndTrailerFields(final Map<FixFieldMeta, String> fields,
                                                          final Map<Integer, String> fieldNames) throws XMLStreamException {
        for (Map.Entry<Integer, String> field : HEADER_FIELDS.entrySet()) {
            fields.put(new FixConstantFieldMeta(field.getKey(), true, ""), field.getValue());
            fieldNames.put(field.getKey(), field.getValue());
        }
        for (Map.Entry<Integer, String> field : TRAILER_FIELDS.entrySet()) {
            fields.put(new FixConstantFieldMeta(field.getKey(), true, ""), field.getValue());
            fieldNames.put(field.getKey(), field.getValue());
        }
    }

    private static void writeHeader(final XMLStreamWriter writer, final String fixProtocolVersion, FixMetaDictionary fixMetaDictionary) throws XMLStreamException {
        if (isLessThan50Version(fixProtocolVersion)) {
            writer.writeStartElement(HEADER);
            for (Map.Entry<Integer, String> field : HEADER_FIELDS.entrySet()) {
                writer.writeStartElement(FIELD);
                writer.writeAttribute(NAME, field.getValue());
                writer.writeAttribute(REQUIRED, YES);
                writer.writeEndElement();
            }
            for (FixMessageMeta<?> message : fixMetaDictionary.getAllMessageMetas()) {
                for (FixFieldMeta field : message.getFields()) {
// Path: fixb/src/main/java/org/fixb/FixConstants.java
// public static final int BEGIN_STRING_TAG = 8;
// 
// Path: fixb/src/main/java/org/fixb/FixConstants.java
// public static final int MSG_TYPE_TAG = 35;


// Path: fixb-quickfix/src/main/java/org/fixb/quickfix/FixMetaDataDictionary.java
import static org.fixb.FixConstants.BEGIN_STRING_TAG;
import static org.fixb.FixConstants.MSG_TYPE_TAG;
import com.google.common.collect.ImmutableMap;
import org.fixb.meta.*;
import quickfix.ConfigError;
import quickfix.DataDictionary;
import quickfix.FixVersions;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.StringWriter;
import java.util.LinkedHashMap;
import java.util.Map;


        } catch (XMLStreamException e) {
            e.printStackTrace();
        }
        return new ByteArrayInputStream(stream.toString().getBytes());
    }

    private static void addStandardHeaderAndTrailerFields(final Map<FixFieldMeta, String> fields,
                                                          final Map<Integer, String> fieldNames) throws XMLStreamException {
        for (Map.Entry<Integer, String> field : HEADER_FIELDS.entrySet()) {
            fields.put(new FixConstantFieldMeta(field.getKey(), true, ""), field.getValue());
            fieldNames.put(field.getKey(), field.getValue());
        }
        for (Map.Entry<Integer, String> field : TRAILER_FIELDS.entrySet()) {
            fields.put(new FixConstantFieldMeta(field.getKey(), true, ""), field.getValue());
            fieldNames.put(field.getKey(), field.getValue());
        }
    }

    private static void writeHeader(final XMLStreamWriter writer, final String fixProtocolVersion, FixMetaDictionary fixMetaDictionary) throws XMLStreamException {
        if (isLessThan50Version(fixProtocolVersion)) {
            writer.writeStartElement(HEADER);
            for (Map.Entry<Integer, String> field : HEADER_FIELDS.entrySet()) {
                writer.writeStartElement(FIELD);
                writer.writeAttribute(NAME, field.getValue());
                writer.writeAttribute(REQUIRED, YES);
                writer.writeEndElement();
            }
            for (FixMessageMeta<?> message : fixMetaDictionary.getAllMessageMetas()) {
                for (FixFieldMeta field : message.getFields()) {
                    if (field.isHeader() && field.getTag() != MSG_TYPE_TAG) {