/// <summary>
        /// Creates a new instance with the provide hash function.
        /// </summary>
        /// <param name="hashFunc">An <see cref="IHashFunction"/> instance.  Throws if <c>null</c>.</param>
        public HashObjectWriter(IHashFunction hashFunc)
        {
            if (hashFunc == null)
            {
                throw new ArgumentNullException(nameof(hashFunc));
            }

            _buffer       = new byte[DefaultBufferSize];
            _hashFunc     = hashFunc;
            _stream       = new CircularMemoryStream(_buffer);
            _streamWriter = new StreamWriter(_stream);
            _writer       = new JsonTextWriter(_streamWriter);

            _stream.OnFlush += OnFlush;
        }