public abstract int
read()() throws IOException
从输入流中读取数据的下一个字节。返回 0 到 255 范围内的 int
字节值。如果因为已经到达流末尾而没有可用的字节,则
返回值 -1。在
输入数据可用、检测到流末尾或者抛出异常前,此方法一直阻塞。
子类必须提供此方法的一个实现。
还有下面两个方法可选,具体的API说明查找java.io.InputStream的说明。
public int read(byte[] b) throws IOException
public int read(byte[] b,int off, int len) throws IOException
字节转整数时注意高地位。