62,614
社区成员
发帖
与我相关
我的任务
分享
public 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));
}