class JaxbConfigFactory implements ConfigFactory {

    @Override
    public Config create(final InputStream configData) {

        byte[] originalData =
                Stream.of(configData)
                        .map(InputStreamReader::new)
                        .map(BufferedReader::new)
                        .flatMap(BufferedReader::lines)
                        .collect(Collectors.joining(System.lineSeparator()))
                        .getBytes();

        final Config initialConfig = JaxbUtil.unmarshal(new ByteArrayInputStream(originalData), Config.class);

        EncryptorConfig encryptorConfig =
                Optional.ofNullable(initialConfig.getEncryptor()).orElse(DEFAULT_ENCRYPTOR_CONFIG);
        // Initialise the key encrypter it will store into holder object.
        keyEncryptorFactory.create(encryptorConfig);

        final Config config = JaxbUtil.unmarshal(new ByteArrayInputStream(originalData), Config.class);
        config.setEncryptor(encryptorConfig);

        return config;
    }

    protected  JaxbConfigFactory(KeyEncryptorFactory keyEncryptorFactory);
    public  JaxbConfigFactory();

}