Creates a stream of bytes. Reads and writes bytes from and to the current position in a given Context object
Наследование: ILoadSave
Пример #1
0
 public LongStream(LongStream longstream)
 {
     this.ostream = new OctetStream (longstream.ostream);
     this.offsets = longstream.offsets;
     this.count = longstream.count;
     this.ctx = new OctetStream.Context ();
 }
Пример #2
0
 public LongStream()
 {
     this.ostream = new OctetStream ();
     this.offsets = new List<int> ();
     this.count = 0;
     this.ctx = new OctetStream.Context ();
 }
Пример #3
0
 public void Encode(long d, OctetStream Output)
 {
     long m;
     while (true) {
         m = d & 127;
         d >>= 7;
         if (d == 0) {
             Output.Add ((byte)(m | 128));
             break;
         } else {
             Output.Add ((byte) m);
         }
     }
 }
Пример #4
0
 public long Decode(OctetStream reader, OctetStream.Context ctx)
 {
     long d = 0;
     int p = 0;
     while (true) {
         long m = reader.Read (ctx);
         d |= (m & 127) << p;
         if ((m & 128) != 0) {
             break;
         }
         p += 7;
     }
     return d;
 }
Пример #5
0
 public OctetStream(OctetStream oct_stream)
 {
     this.buff = oct_stream.buff;
 }
Пример #6
0
 public void Decompress(List<long> list, OctetStream.Context ctx, int count)
 {
     for (int i = 0; i < count; ++i) {
         var u = CODER.Decode (this.ostream, ctx);
         list.Add (u);
     }
 }