Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

BufferedInputStream mark() method  RSS feed

 
Vasco Saavedra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

What is suppose to happen when using the mark() method in the class BufferedInputStream ?

Suppose I have a 50MB file.

BufferedInputStream bis = new BufferedInputStream(new FileInputStream(filepath));

bis.mark(52 428 800);

Does this mean that I�m putting the entire 50MB file to memory?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Vasco]: Does this mean that I�m putting the entire 50MB file to memory?

Not immediately, but if you then read the entire file without calling reset() or mark() again, the BIS will have been forced to keep the entire contents in memory, yes. Or die trying.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I liked the wording in the doc that the stream "somehow remembers all the bytes read". Guess it doesn't have to be memory. Could be in a transporter loop.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!