Esempio n. 1
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());
        }
Esempio n. 2
0
        public Buf dup()
        {
            int size = (int)this.size();

            byte[] copy = new byte[size];
            getBytes(0, copy, 0, size);

            Buf result = new MemBuf(copy, size);

            result.charset(charset());
            return(result);
        }
Esempio n. 3
0
        public Buf getRange(Range range)
        {
            long size = getSize();
            long s    = range.start(size);
            long e    = range.end(size);
            int  n    = (int)(e - s + 1);

            if (n < 0)
            {
                throw IndexErr.make(range).val;
            }

            byte[] slice = new byte[n];
            getBytes(s, slice, 0, n);

            Buf result = new MemBuf(slice, n);

            result.charset(charset());
            return(result);
        }
Esempio n. 4
0
File: Buf.cs Progetto: nomit007/f4
        public Buf getRange(Range range)
        {
            long size = getSize();
              long s = range.start(size);
              long e = range.end(size);
              int n = (int)(e - s + 1);
              if (n < 0) throw IndexErr.make(range).val;

              byte[] slice = new byte[n];
              getBytes(s, slice, 0, n);

              Buf result = new MemBuf(slice, n);
              result.charset(charset());
              return result;
        }
Esempio n. 5
0
File: Buf.cs Progetto: nomit007/f4
        public Buf dup()
        {
            int size = (int)this.size();
              byte[] copy = new byte[size];
              getBytes(0, copy, 0, size);

              Buf result = new MemBuf(copy, size);
              result.charset(charset());
              return result;
        }
Esempio n. 6
0
File: FanStr.cs Progetto: 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();
 }