class EbtsBuilder {

    public byte[] build(final Ebts ebts) throws EbtsBuildingException {
        this.ebts = ebts;
        //Create the auto-expanding output stream
        final ByteArrayOutputStream baos = new ByteArrayOutputStream();
        //Get list of all records
        //Overwrite CNT field(1.03)
        final List<LogicalRecord> records = ebts.getAllRecords();
        for (final LogicalRecord record : records) {

            if (genericTypes.contains(record.getRecordType())) {
                genericBuilder((GenericRecord)record,baos);
            } else if (binaryHeaderTypes.contains(record.getRecordType())) {
                binaryHeaderBuilder((BinaryHeaderImageRecord)record,baos);
            }
        }
        return baos.toByteArray();
    }

    public  EbtsBuilder();
    public  EbtsBuilder(final int precedingZeros);

}