简体   繁体   中英

what is meaning of “readlimit” parameter at mark method in java?

BufferedInputStream.mark(int readlimit) 

I read java doc but I don't understand when we use this parameter " readlimit " in this code, I don't understand what's different between mark(1) or mark(100)

public static void main(String[] args) throws Exception {
String s="123456789ABCDEFGHIJKLMNOPQRSDVWXYZ";
byte byteArray[]=s.getBytes();
ByteArrayInputStream BArrayIS=new ByteArrayInputStream(byteArray);
BufferedInputStream BIS=new BufferedInputStream(BArrayIS);
BIS.mark(1);
System.out.println(BIS.read());
}

It has no effect because BufferedInputStream.mark method effects `` which is used in reset method that you don't use.

Repositions this stream to the position at the time the mark method

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM