Close() public method

public Close ( ) : void
return void
示例#1
0
        internal static object DumpAll(RubyRepresenter /*!*/ rep, IEnumerable /*!*/ objs, RubyIO io)
        {
            TextWriter writer;

            if (io != null)
            {
                writer = new RubyIOWriter(io);
            }
            else
            {
                // the output is ascii:
                writer = new MutableStringWriter(MutableString.CreateMutable(RubyEncoding.Binary));
            }

            YamlOptions cfg = YamlOptions.DefaultOptions;
            Serializer  s   = new Serializer(writer, cfg);

            foreach (object obj in objs)
            {
                s.Serialize(rep.Represent(obj));
                rep.ForgetObjects();
            }
            s.Close();

            if (io != null)
            {
                return(io);
            }
            else
            {
                return(((MutableStringWriter)writer).String);
            }
        }
示例#2
0
        public static object QuickEmit(YamlCallSiteStorage /*!*/ siteStorage, [NotNull] BlockParam /*!*/ block, RubyModule /*!*/ self, object objectId, [NotNull] Hash /*!*/ opts)
        {
            // TODO: load from opts
            YamlOptions cfg = YamlOptions.DefaultOptions;

            MutableStringWriter writer = new MutableStringWriter(MutableString.CreateMutable(RubyEncoding.Binary));
            Serializer          s      = new Serializer(writer, cfg);
            RubyRepresenter     rep    = new RubyRepresenter(siteStorage);
            object result;

            if (block.Yield(new Syck.Out(rep), out result))
            {
                return(result);
            }

            s.Serialize(rep.ToNode(result));
            s.Close();

            return(writer.String);
        }
示例#3
0
        public static object QuickEmit(YamlCallSiteStorage/*!*/ siteStorage, [NotNull]BlockParam/*!*/ block, RubyModule/*!*/ self, object objectId, [NotNull]Hash/*!*/ opts) {
            // TODO: load from opts
            YamlOptions cfg = YamlOptions.DefaultOptions;
            
            MutableStringWriter writer = new MutableStringWriter(MutableString.CreateMutable(RubyEncoding.Binary));
            Serializer s = new Serializer(writer, cfg);
            RubyRepresenter rep = new RubyRepresenter(siteStorage);
            object result;
            
            if (block.Yield(new Syck.Out(rep), out result)) {
                return result;
            }

            s.Serialize(rep.ToNode(result));
            s.Close();

            return writer.String;
        }
示例#4
0
        internal static object DumpAll(RubyRepresenter/*!*/ rep, IEnumerable/*!*/ objs, RubyIO io) {
            TextWriter writer;
            if (io != null) {
                writer = new RubyIOWriter(io);
            } else {
                // the output is ascii:
                writer = new MutableStringWriter(MutableString.CreateMutable(RubyEncoding.Binary));
            }

            YamlOptions cfg = YamlOptions.DefaultOptions;
            Serializer s = new Serializer(writer, cfg);
            foreach (object obj in objs) {
                s.Serialize(rep.Represent(obj));
                rep.ForgetObjects();
            }
            s.Close();

            if (io != null) {
                return io;
            } else {
                return ((MutableStringWriter)writer).String;
            }
        }