求高手给我解释一下这几个方法是什么意思
index是个全局变量,初始值为0public short readShort(byte[] dis)
{
int firstByte = dis[index++];
int secondByte = dis[index++];
return (short)(firstByte & 0xff | secondByte << 8);
} public byte readByte(byte[] dis)
{
return (byte)(dis[index++] & 0xff);
} public int readInt(BinaryReader dis)
{
int a = dis.Read();
int b = dis.Read();
int c = dis.Read();
int d = dis.Read();
if ((a | b | c | d) < 0)
throw new Exception();
else
return (d << 24) + (c << 16) + (b << 8) + (a << 0);
} public char readChar(BinaryReader dis)
{
int a = dis.Read();
int b = dis.Read();
if ((a | b) < 0)
throw new Exception();
else
return (char)((b << 8) + (a << 0));
}
index是个全局变量,初始值为0public short readShort(byte[] dis)
{
int firstByte = dis[index++];
int secondByte = dis[index++];
return (short)(firstByte & 0xff | secondByte << 8);
} public byte readByte(byte[] dis)
{
return (byte)(dis[index++] & 0xff);
} public int readInt(BinaryReader dis)
{
int a = dis.Read();
int b = dis.Read();
int c = dis.Read();
int d = dis.Read();
if ((a | b | c | d) < 0)
throw new Exception();
else
return (d << 24) + (c << 16) + (b << 8) + (a << 0);
} public char readChar(BinaryReader dis)
{
int a = dis.Read();
int b = dis.Read();
if ((a | b) < 0)
throw new Exception();
else
return (char)((b << 8) + (a << 0));
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货