how to find last part of file(with size less than block size of file system) on the disk using java?

I am working on a project where I have to find the full file or the part of files stored on disk using java. Here is what i am doing 1) divide a reference file into parts(same in size of block size of file system) and create its hash and save in database 2) for search for that reference file, I divide the disk into parts(same size of block size of file system) and create hash and then look for the match of hashes. Now all is fine until I reach the last part of file which will most probably NOT be equal to the block size of file system. and same is the case when file was stored on the disk.so the hashes do not match of course. So how can I find this last part of file with size less than block size of file system?
Why are you concerned about the physical block size? Between the harddisk and the OS, they can't even agree whether it's 512 bytes or 4KB. And modern SSDs compress the data on the fly, making a mockery of the whole notion of block size. Your algorithm would still work if you just divide the file in 4KB blocks regardless of the underlying storage system, so just hardcode that.

以上就是how to find last part of file(with size less than block size of file system) on the disk using java?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏