public override void writeObject(object obj) { if (_ctx == null) { ExportContext ctx = new ExportContext(_out); // write the preamble ctx.writeInt(unchecked((int)MAGIC_NUMBER)); ctx.writeSbyte(unchecked((sbyte)VERSION)); int flags = 0; if (_compress) { flags |= COMPRESSED_FORMAT_FLAG; } Streams.writeVarInt(_out, flags); // everything thereafter will be compressed if so requested if (_compress) { ctx.stream = _out = new ZlibStream(_out, CompressionMode.Compress, !_disposeBase); } _ctx = ctx; } _ctx.writeObject(obj, ObjectTypeData.INSTANCE); }
public override void writeObject(ExportContext ctx, object value, TypeData[] typeArguments = null) { ctx.writeInt((int)value); }