• Post Reply Bookmark Topic Watch Topic
  • New Topic

Get size of InputStream

 
Mauricio Payetta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I need to get the size of an InputStream without converting it into a File. Is there any way to do this using the Java NIO package?
Thanks in advance!
 
Rob Spoor
Sheriff
Posts: 20821
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch!

It's not possible to get the size of any arbitrary InputStream, because often not all data is available yet. For instance, if you read data from a Socket, some data may not even have been sent yet.
 
Mauricio Payetta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, understood. Thanks for your answer!
 
Rob Spoor
Sheriff
Posts: 20821
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!