Otp.OtpOutputStream.write C# (CSharp) Метод

write() публичный Метод

public write ( byte b ) : void
b byte
Результат void
        public virtual void  write(byte b)
        {
            if (_count >= _size)
            {
                // System.err.println("Expanding buffer from " + size + " to " + size + defaultIncrement);
                byte[] tmp = new byte[_size + defaultIncrement];
                Array.Copy(buf, 0, tmp, 0, _count);
                _size += defaultIncrement;
                buf = tmp;
            }
            
            buf[_count++] = b;
        }
        

Usage Example

Пример #1
0
 protected internal virtual void  sendStatus(System.String status)
 {
     
     OtpOutputStream obuf = new OtpOutputStream();
     obuf.write2BE(status.Length + 1);
     obuf.write1(ChallengeStatus);
     //UPGRADE_NOTE: This code will be optimized in the future;
     byte[] tmpBytes;
     int i;
     string tmpStr;
     tmpStr = status;
     tmpBytes = new byte[tmpStr.Length];
     i = 0;
     while (i < tmpStr.Length)
     {
         tmpBytes[i] = (byte) tmpStr[i];
         i++;
     }
     obuf.write(tmpBytes);
     
     obuf.writeTo((System.IO.Stream) socket.GetStream());
     
     if (traceLevel >= OtpTrace.Type.handshakeThreshold)
     {
         OtpTrace.TraceEvent("-> " + "HANDSHAKE sendStatus" + " status=" + status + " local=" + self);
     }
 }
All Usage Examples Of Otp.OtpOutputStream::write