0
在Loooking的InputStream我们可以发现几个方法:的InputStream:INT /长参数混合
public abstract int read() throws IOException;
public int read(byte b[]) throws IOException;
public int read(byte b[], int off, int len) throws IOException
public long skip(long n) throws IOException
public int available() throws IOException
public synchronized void mark(int readlimit)
除了所有方法跳过()处理INT参数。唯一方法跳过()接受长参数。是什么使型长没有INT的这个参数的意义呢?从的InputStream延伸,使自己的实现时,它看起来不舒服。
,其他方法都接受'int'是很明显的:你不能阅读更多然后“最大诚信”反正。为什么要跳过限制为'int'?如果你想跳过900000000000字符/字节怎么办?跳过多次?这个任意约束没有意义,因此他们使用“long”。 – Tom
如果它是'int',则只能跳过2个GiB,您可以使用更大的流。 – Oleg