Encode() private static method

private static Encode ( Stream outStream, int data, int len ) : void
outStream Stream
data int
len int
return void
 public override void Close()
 {
     if (this.type != null)
     {
         if (this.bufPtr > 0)
         {
             ArmoredOutputStream.Encode(this.outStream, this.buf, this.bufPtr);
         }
         this.DoWrite(ArmoredOutputStream.nl + '=');
         int value = this.crc.Value;
         this.buf[0] = (value >> 16 & 255);
         this.buf[1] = (value >> 8 & 255);
         this.buf[2] = (value & 255);
         ArmoredOutputStream.Encode(this.outStream, this.buf, 3);
         this.DoWrite(ArmoredOutputStream.nl);
         this.DoWrite(ArmoredOutputStream.footerStart);
         this.DoWrite(this.type);
         this.DoWrite(ArmoredOutputStream.footerTail);
         this.DoWrite(ArmoredOutputStream.nl);
         this.outStream.Flush();
         this.type  = null;
         this.start = true;
         base.Close();
     }
 }
        public override void WriteByte(byte b)
        {
            if (this.clearText)
            {
                this.outStream.WriteByte(b);
                if (this.newLine)
                {
                    if (b != 10 || this.lastb != 13)
                    {
                        this.newLine = false;
                    }
                    if (b == 45)
                    {
                        this.outStream.WriteByte(32);
                        this.outStream.WriteByte(45);
                    }
                }
                if (b == 13 || (b == 10 && this.lastb != 13))
                {
                    this.newLine = true;
                }
                this.lastb = (int)b;
                return;
            }
            if (this.start)
            {
                bool flag = (b & 64) != 0;
                int  num;
                if (flag)
                {
                    num = (int)(b & 63);
                }
                else
                {
                    num = (b & 63) >> 2;
                }
                switch (num)
                {
                case 2:
                    this.type = "SIGNATURE";
                    goto IL_EF;

                case 5:
                    this.type = "PRIVATE KEY BLOCK";
                    goto IL_EF;

                case 6:
                    this.type = "PUBLIC KEY BLOCK";
                    goto IL_EF;
                }
                this.type = "MESSAGE";
IL_EF:
                this.DoWrite(ArmoredOutputStream.headerStart + this.type + ArmoredOutputStream.headerTail + ArmoredOutputStream.nl);
                this.WriteHeaderEntry("Version", (string)this.headers["Version"]);
                foreach (DictionaryEntry dictionaryEntry in this.headers)
                {
                    string text = (string)dictionaryEntry.Key;
                    if (text != "Version")
                    {
                        string v = (string)dictionaryEntry.Value;
                        this.WriteHeaderEntry(text, v);
                    }
                }
                this.DoWrite(ArmoredOutputStream.nl);
                this.start = false;
            }
            if (this.bufPtr == 3)
            {
                ArmoredOutputStream.Encode(this.outStream, this.buf, this.bufPtr);
                this.bufPtr = 0;
                if ((++this.chunkCount & 15) == 0)
                {
                    this.DoWrite(ArmoredOutputStream.nl);
                }
            }
            this.crc.Update((int)b);
            this.buf[this.bufPtr++] = (int)(b & 255);
        }