This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best approch to read files as Byte

 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In our application we use 3rd party checksum digest lib that requited to give source file as a byte array or as a ByteBuffer. Source files can be very to 1Mb to ~1GB . Here what is the most efficient approach to read those files in to byte array or ByteBuffer ?
 
Rob Spoor
Sheriff
Pie
Posts: 20552
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure the lib requires the entire file to be passed into one single byte[] or ByteBuffer? Is it not something like MessageDigest that allows you to update the checksum with chunks at a time? For instance:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic