示例#1
0
文件: Err.cs 项目: syatanic/fantom
        public string traceToStr()
        {
            Buf buf = new MemBuf(1024);

            trace(buf.@out());
            return(buf.flip().readAllStr());
        }
示例#2
0
        public static Buf toBuf(string self, Charset charset)
        {
            MemBuf buf = new MemBuf(self.Length * 2);

            buf.charset(charset);
            buf.print(self);
            return(buf.flip());
        }
示例#3
0
        /**
         * Make a thread-safe copy of the specified object.
         * If it is immutable, then just return it; otherwise
         * we make a serialized copy.
         */
        public static object safe(object obj)
        {
            if (obj == null)
            {
                return(null);
            }
            if (FanObj.isImmutable(obj))
            {
                return(obj);
            }
            Buf buf = new MemBuf(512);

            buf.writeObj(obj);
            buf.flip();
            return(buf.readObj());
        }
示例#4
0
文件: FanStr.cs 项目: xored/f4
 public static Buf toBuf(string self, Charset charset)
 {
     MemBuf buf = new MemBuf(self.Length*2);
       buf.charset(charset);
       buf.print(self);
       return buf.flip();
 }
示例#5
0
文件: Err.cs 项目: nomit007/f4
 public string traceToStr()
 {
     Buf buf = new MemBuf(1024);
       trace(buf.@out());
       return buf.flip().readAllStr();
 }
示例#6
0
文件: Sys.cs 项目: nomit007/f4
 /**
  * Make a thread-safe copy of the specified object.
  * If it is immutable, then just return it; otherwise
  * we make a serialized copy.
  */
 public static object safe(object obj)
 {
     if (obj == null) return null;
       if (FanObj.isImmutable(obj)) return obj;
       Buf buf = new MemBuf(512);
       buf.writeObj(obj);
       buf.flip();
       return buf.readObj();
 }