public static IWriter <T> GetJsonInstance <T>(Stream output, IDictionary <Type, IWriteHandler> customHandlers, bool verboseMode)
        {
            TextWriter textWriter = new StreamWriter(output);
            JsonWriter jsonWriter = new JsonTextWriter(textWriter);
            IImmutableDictionary <Type, IWriteHandler> handlers = Handlers(customHandlers);
            JsonEmitter emitter;

            if (verboseMode)
            {
                emitter = new JsonVerboseEmitter(jsonWriter, GetVerboseHandlers(handlers));
            }
            else
            {
                emitter = new JsonEmitter(jsonWriter, handlers);
            }

            SetSubHandler(handlers, emitter);
            WriteCache wc = new WriteCache(!verboseMode);

            return(new Writer <T>(output, emitter, wc));
        }
 public Writer(Stream output, JsonEmitter emitter, WriteCache wc)
 {
     this.output  = output;
     this.emitter = emitter;
     this.wc      = wc;
 }