Exemplo n.º 1
0
 public override void WriteInt(int value)
 {
     if (this.position + 4 <= MAX_BLOCK_SIZE)
     {
         JavaBits.PutInt(this.buffer, this.position, value);
         this.position += 4;
     }
 }
Exemplo n.º 2
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);
     }
 }