Java examples for java.io:InputStream Read
read Int from InputStream
//package com.java2s; import java.io.EOFException; import java.io.IOException; import java.io.InputStream; public class Main { public static 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); }/*from w ww. j av a 2s .com*/ }