public void ToFile(string path, JsonComposeSettings settings = null) { using (var writer = new JsonWriter(path, settings == null ? new JsonComposeSettings() : settings)) { Compose(writer); } }
private void ToStream(Stream stream, JsonComposeSettings settings) { #if NET45 using (var writer = new JsonWriter(stream, settings, 1024, true)) { Compose(writer); } #else using (var writer = new JsonWriter(stream, settings)) { Compose(writer); } #endif }
public byte[] ToBytes(JsonComposeSettings settings) { #if NET45 using (var stream = new MemoryStream()) #else using (var stream = new MyMemoryStream()) #endif { ToStream(stream, settings); stream.Position = 0; var bytes = stream.ToArray(); #if !NET45 stream.ReallyClose(); #endif return(bytes); } }
public string ToString(JsonComposeSettings settings) { #if NET45 using (var stream = new MemoryStream()) #else using (var stream = new MyMemoryStream()) #endif { ToStream(stream, settings); stream.Position = 0; var result = settings.Encoding.GetString(stream.ToArray()); #if !NET45 stream.ReallyClose(); #endif return(result); } }
public JsonWriter(string path, JsonComposeSettings settings, bool append, int bufferSize) : base(path, append, settings.Encoding, bufferSize) { _settings = new JsonComposeSettings(); }
public JsonWriter(string path, JsonComposeSettings settings) : base(path, false, settings.Encoding) { _settings = settings; }
public JsonWriter(Stream stream, JsonComposeSettings settings, int bufferSize, bool leaveOpen) : base(stream, settings.Encoding, bufferSize, leaveOpen) { _settings = settings; }
public JsonWriter(Stream stream, JsonComposeSettings settings) : base(stream, settings.Encoding) { _settings = settings; }
public JsonWriter(string path, bool append, Encoding encoding) : base(path, append, encoding) { _settings = new JsonComposeSettings(); }
public JsonWriter(string path, bool append) : base(path, append) { _settings = new JsonComposeSettings(); }
public JsonWriter(string path) : base(path) { _settings = new JsonComposeSettings(); }
public JsonWriter(Stream stream, Encoding encoding, int bufferSize, bool leaveOpen) : base(stream, encoding, bufferSize, leaveOpen) { _settings = new JsonComposeSettings(); }
public JsonWriter(Stream stream, Encoding encoding) : base(stream, encoding) { _settings = new JsonComposeSettings(); }
public JsonWriter(Stream stream) : base(stream) { _settings = new JsonComposeSettings(); }