• 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
Posts: 20831
68
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:
 
expectation is the root of all heartache - shakespeare. tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!