func (b *BasicMessage) SetSize() error {
	if b.HBCIMessage == nil {
		return fmt.Errorf("HBCIMessage must be set")
	}
	var buffer bytes.Buffer
	headerBytes, err := b.Header.MarshalHBCI()
	if err != nil {
		return err
	}
	buffer.Write(headerBytes)
	if b.SignatureBegin != nil {
		sigBytes, err := b.SignatureBegin.MarshalHBCI()
		if err != nil {
			return err
		}
		buffer.Write(sigBytes)
	}
	for _, segment := range b.HBCIMessage.HBCISegments() {
		if !reflect.ValueOf(segment).IsNil() {
			segBytes, err := segment.MarshalHBCI()
			if err != nil {
				return err
			}
			buffer.Write(segBytes)
		}
	}
	if b.SignatureEnd != nil {
		sigEndBytes, err := b.SignatureEnd.MarshalHBCI()
		if err != nil {
			return err
		}
		buffer.Write(sigEndBytes)
	}
	endBytes, err := b.End.MarshalHBCI()
	if err != nil {
		return err
	}
	buffer.Write(endBytes)
	b.Header.SetSize(buffer.Len())
	return nil
}
// SetSize writes the size of the marshaled message into the message header
SetSize writes the size of the marshaled message into the message header
// SetSize writes the size of the marshaled message into the message header
func (b *BasicMessage) SetSize() error {
	if b.HBCIMessage == nil {
		return fmt.Errorf("HBCIMessage must be set")
	}
	var buffer bytes.Buffer
	headerBytes, err := b.Header.MarshalHBCI()
	if err != nil {
		return err
	}
	buffer.Write(headerBytes)
	if b.SignatureBegin != nil {
		sigBytes, err := b.SignatureBegin.MarshalHBCI()
		if err != nil {
			return err
		}
		buffer.Write(sigBytes)
	}
	for _, segment := range b.HBCIMessage.HBCISegments() {
		if !reflect.ValueOf(segment).IsNil() {
			segBytes, err := segment.MarshalHBCI()
			if err != nil {
				return err
			}
			buffer.Write(segBytes)
		}
	}
	if b.SignatureEnd != nil {
		sigEndBytes, err := b.SignatureEnd.MarshalHBCI()
		if err != nil {
			return err
		}
		buffer.Write(sigEndBytes)
	}
	endBytes, err := b.End.MarshalHBCI()
	if err != nil {
		return err
	}
	buffer.Write(endBytes)
	b.Header.SetSize(buffer.Len())
	return nil
}
func ( b * BasicMessage ) SetSize ( ) error { if b . HBCIMessage == nil { return fmt . Errorf ( " " ) } var buffer bytes . Buffer headerBytes , err := b . Header . MarshalHBCI ( ) if err != nil { return err } buffer . Write ( headerBytes ) if b . SignatureBegin != nil { sigBytes , err := b . SignatureBegin . MarshalHBCI ( ) if err != nil { return err } buffer . Write ( sigBytes ) } for _ , segment := range b . HBCIMessage . HBCISegments ( ) { if ! reflect . ValueOf ( segment ) . IsNil ( ) { segBytes , err := segment . MarshalHBCI ( ) if err != nil { return err } buffer . Write ( segBytes ) } } if b . SignatureEnd != nil { sigEndBytes , err := b . SignatureEnd . MarshalHBCI ( ) if err != nil { return err } buffer . Write ( sigEndBytes ) } endBytes , err := b . End . MarshalHBCI ( ) if err != nil { return err } buffer . Write ( endBytes ) b . Header . SetSize ( buffer . Len ( ) ) return nil }
SetSize writes the size of the marshaled message into the message header
SetSize writes the size of the marshaled message into the message header