Agnos.Transports.BaseTransport.readSInt32 C# (CSharp) Method

readSInt32() protected static method

protected static readSInt32 ( Stream stream ) : int
stream Stream
return int
        protected static int readSInt32(Stream stream)
        {
            byte[] buf = new byte[4];
            int len = stream.Read(buf, 0, buf.Length);
            if (len < buf.Length) {
                throw new EndOfStreamException("expected " + buf.Length + " bytes, got " + len);
            }
            return ((int)(buf[0] & 0xff) << 24) |
                    ((int)(buf[1] & 0xff) << 16) |
                    ((int)(buf[2] & 0xff) << 8) |
                    ((int)(buf[3] & 0xff));
        }