如何将文件分成块 [英] how to divide the file into blocks

查看:106
本文介绍了如何将文件分成块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hai朋友,
如果我们给定了应该分成几个块的输入文件,并且为每个块分配了哈希值,那么我想用任何一种语言回答.而且plz告诉我如何为每个块给出哈希值. div class ="h2_lin">解决方案


  1. 确定构成一个块的字节数
  2. 确定将使用哪种算法创建哈希值
  3. 从文件中读取每个块
  4. 创建一个该块的哈希值
  5. 将哈希值保存在某个地方


作业已完成.


Java:

^ ]可能会帮助您切碎.

java.lang.String [ ^ ]具有函数hashcode(),该函数将返回所需的int值.

这看起来很像是一项家庭作业,所以现在该轮到您首先提供代码了.


hai friends,
If we given the input file that should be divided into certain blocks and for that each block we should asign the hash value.I want answer in any of those languages..And also plz tell me how to give hash value for each block.

解决方案


  1. Decide how many bytes constitute a block
  2. Decide what algorithm you will use to create a hash value
  3. Read each block from the file
  4. Create a hash value from that block
  5. Save the hash value somewhere


Job done.


Java:

StringTokenizer[^] might help you on the chopping.

java.lang.String[^] has a function hashcode() that would return the desired int value.

This is looking pretty much like a homework, so It is your turn to provide code first.


这篇关于如何将文件分成块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆