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

How to get the file data in chunks  RSS feed

 
dhananjaykumar singh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am accessing a file using "InputStream" and getting the whole document data. My requirement is to get the document data in chunk(or in small pieces).

Can you please tell me how to perform this operation of getting whole file contents in collection of small pieces.

thanks in advance,
Dhananjay
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The read( byteArray ) method will read up to the size of the array. Would that work as a chunk for you? You could put a read like this in a loop until it returns -1 for end of stream.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!