Example #1
0
 public override void WriteShort(short value)
 {
     if (this.position + 2 <= MAX_BLOCK_SIZE)
     {
         JavaBits.PutShort(this.buffer, this.position, value);
         this.position += 2;
     }
 }
Example #2
0
 public override void WriteChar(char value)
 {
     if (this.position + 2 <= MAX_BLOCK_SIZE)
     {
         JavaBits.PutChar(this.buffer, this.position, value);
         this.position += 2;
     }
 }
Example #3
0
 public override void WriteLong(long value)
 {
     if (this.position + 8 <= MAX_BLOCK_SIZE)
     {
         JavaBits.PutLong(this.buffer, this.position, value);
         this.position += 8;
     }
 }
Example #4
0
 public override void WriteInt(int value)
 {
     if (this.position + 4 <= MAX_BLOCK_SIZE)
     {
         JavaBits.PutInt(this.buffer, this.position, value);
         this.position += 4;
     }
 }
Example #5
0
 public override void WriteDouble(double value)
 {
     if (this.position + 8 <= MAX_BLOCK_SIZE)
     {
         JavaBits.PutDouble(this.buffer, this.position, value);
         this.position += 8;
     }
 }
Example #6
0
        public override void WriteBoolean(bool value)
        {
            if (this.position >= MAX_BLOCK_SIZE)
            {
                this.Drain();
            }

            JavaBits.PutBoolean(this.buffer, this.position++, value);
        }
Example #7
0
 /// <summary>
 /// Writes block data header.
 /// Data block shorter than 256 bytes are prefixed with a 2-byte header; all others start with a 5-byte header.
 /// </summary>
 /// <param name="position"></param>
 private void WriteBlockHeader(int position)
 {
     if (position <= 0xFF)
     {
         this.hBuffer[0] = TC_BLOCKDATA;
         this.hBuffer[1] = (byte)position;
         this.Stream.Write(this.hBuffer, 0, 2);
     }
     else
     {
         this.hBuffer[0] = TC_BLOCKDATALONG;
         JavaBits.PutInt(this.hBuffer, 1, position);
         this.Stream.Write(this.hBuffer, 0, 5);
     }
 }