File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Best approch to read files as Byte Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Best approch to read files as Byte " Watch "Best approch to read files as Byte " New topic
Author

Best approch to read files as Byte

Dilshan Edirisuriya
Ranch Hand

Joined: Apr 22, 2006
Posts: 299
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 ?

Dilshan Edirisuriya SCJP1.4, SCWCD1.4, SCBCD 5
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19757
    
  20

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:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best approch to read files as Byte