<commit_before>﻿#if FEATURE_JIL
namespace Nine.Formatting
{
    using System;
    using System.IO;
    using System.Text;
    using Jil;

    public class JilFormatter : IFormatter, ITextFormatter
    {
        private readonly Encoding _encoding = new UTF8Encoding(false, true);
        private readonly Options _options = new Options(
            prettyPrint: false,
            excludeNulls: true,
            jsonp: false,
            dateFormat: DateTimeFormat.ISO8601,
            includeInherited: true,
            unspecifiedDateTimeKindBehavior: UnspecifiedDateTimeKindBehavior.IsUTC,
            serializationNameFormat: SerializationNameFormat.CamelCase);

        public void WriteTo(object value, Stream stream)
        {
            using (var writer = new StreamWriter(stream, _encoding, 1024, leaveOpen: true))
            {
                JSON.Serialize(value, writer, _options);
            }<commit_msg>Add options to JilFormatter<commit_after>﻿#if FEATURE_JIL
namespace Nine.Formatting
{
    using System;
    using System.IO;
    using System.Text;
    using Jil;

    public class JilFormatter : IFormatter, ITextFormatter
    {
        private readonly Encoding _encoding = new UTF8Encoding(false, true);
        private readonly Options _options;
       
        public JilFormatter()
        {
            _options = new Options(
                prettyPrint: false,
                excludeNulls: true,
                jsonp: false,
                dateFormat: DateTimeFormat.ISO8601,
                includeInherited: true,
                unspecifiedDateTimeKindBehavior: UnspecifiedDateTimeKindBehavior.IsUTC,
                serializationNameFormat: SerializationNameFormat.CamelCase);
        }
        
        public JilFormatter(Options options)
        {
            if (options == null) throw new ArgumentNullException(nameof(options));
            
            _options = options;
        }

        public void WriteTo(object value, Stream stream)
        {
            using (var writer = new StreamWriter(stream, _encoding, 1024, leaveOpen: true))
            {
                JSON.Serialize(value, writer, _options);
            }
{'fraction_non_alphanumeric': 0.06629834254143646, 'fraction_numerical': 0.008287292817679558, 'mean_word_length': 2.0692090395480225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4879249', 'n_tokens_mistral': 563, 'n_tokens_neox': 530, 'n_words': 141}