markSupported

使用InputStream的markSupported、mark和reset

两盒软妹~` 提交于 2020-02-28 14:28:19
使用InputStream的markSupported、mark和reset mark用于标记地方,以后再调用reset时就可以再回到这个mark过的地方。 mark方法有个整型参数,意思是,在读出这么多个字符之前,保持mark有效。 比如说mark(10),那么在read()10个以内的字符时,reset()操作后可以重新读取已经读出的数据, 如果已经读取的数据超过10个,那reset()操作后,就不能正确读取以前的数据了,因为此时mark标记已经失效。 Marks the current position in this input stream. A subsequent call to the reset method repositions this stream at the last marked position so that subsequent reads re-read the same bytes. The readlimit arguments tells this input stream to allow that many bytes to be read before the mark position gets invalidated. The general contract of mark is that, if the method