Permalink
Browse files

readInt() modified in StdInClient

  • Loading branch information...
pzemtsov committed Jan 29, 2015
1 parent 239ae47 commit 854a9a87d56114eb01011c01332f1368ddd2c796
Showing with 3 additions and 8 deletions.
  1. +3 −8 StdInClient.java
View
@@ -40,15 +40,10 @@ public static void main (String [] args) throws Exception
private static final int readInt (InputStream in) throws IOException
{
- int ch1 = in.read();
- int ch2 = in.read();
- int ch3 = in.read();
- int ch4 = in.read();
- if ((ch1 | ch2 | ch3 | ch4) < 0)
- throw new EOFException();
- return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
+ byte [] b = readBytes (in, 4);
+ return (((b[0] & 0xFF) << 24) + ((b[1] & 0xFF) << 16) + ((b[2] & 0xFF) << 8) + ((b[3] & 0xFF) << 0));
}
-
+
private static void processMessage (byte [] type, byte [] msg)
{
}

0 comments on commit 854a9a8

Please sign in to comment.