我尝试通过java生成代码,能够从文件中读取100 kb然后将文件分成块,每个块有256位或32位也希望将每个块转换为二进制格式或整数格式以下是它 我需要任何建议
public static void main(String[] args) {
ReadFileExample newclass = new ReadFileExample();
System.out.println("-----------Wellcome in ECC ENCRYPTION NEW--------");
File clearmsg = new File("F:/java_projects/clearmsg.txt");
File ciphermsg = new File("F:/java_projects/ciphermsg.txt");
byte[] block = new byte[32];
try {
FileInputStream fis = new FileInputStream(clearmsg);
FileOutputStream fos = new FileOutputStream(ciphermsg);
CipherOutputStream cos = new CipherOutputStream(fos);
System.out.println("Total file size to read (in bytes) : "
+ fis.available());
int i;
while ((i = fis.read(block)) != -1) {
System.out.println(block);
fos.write(block, 0, i);
}
fos.close();