public KarmaSerializer(Stream stream, KarmaOptions options = null) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (!stream.CanWrite) { throw new ArgumentException("Can not write to stream."); } this.writer = new KarmaWriter(stream); this.stream = stream; this.options = options ?? new KarmaOptions(); WriteHeader(); }
public KarmaDeserializer(Stream stream, KarmaOptions options = null) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (!stream.CanRead) { throw new ArgumentException("Stream can not be read."); } this.stream = stream; this.reader = new KarmaReader(stream); this.options = options ?? new KarmaOptions(); this.assemblies = AppDomain.CurrentDomain.GetAssemblies(); ReadHeader(); }