xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 4KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-11
  • 語言: Java
  • 標簽: 單表??加密??java??

資源簡介

單表代換加密算法的java實現,僅限于對英文.txt文檔的加密

資源截圖

代碼片段和文件信息


//在計算機中,我們可以將文件分為文本文件(text?file)和二進制文件(binary?file)兩種。
//文本文件中只包含字母、數字、標點及一些特殊字符,這些字符有一個共同點,
//它們最多只有7位有效編碼,即使用8位編碼格式的字節中最高位為0,
//我們也常將這種文件稱為ASCII文件。
//二進制文件中則可以包括任意數據,所以它的數據字節中常常有最高位為1的字節,
//即它的8位字節編碼都是有效的。

import?java.io.*;

public?class?Monoalphabetic?{
private?String?srcFilePath;
private?String?prnPath;

public?Monoalphabetic(String?filePathString?parentPath){
this.srcFilePath?=?filePath;
this.prnPath?=?parentPath;
}

public?void?cipher(){
try{
???????? File?sourceFile?=?new?File(srcFilePath);

???????? File?outFile?=?new?File(prnPath+“\\Monoalphabetic?encryption.txt“);
outFile.createNewFile();

//實現方案1:用BufferedReader一個字符一個字符讀寫
//???????? BufferedReader?in?=?new?BufferedReader(new?FileReader(sourceFile));
// BufferedWriter?out?=?new?BufferedWriter(new?FileWriter(outFile));
//???????? int?inChar;
//???????? while((inChar=in.read())!=-1){
//???????? inChar++;
//???????? out.write(inChar);
//???????? }
//???????? in.close();
//???????? out.close();
????????
???????? //實現方案2:用RandomAccessFile一個字符一個字符讀寫
//???????? RandomAccessFile?sf?=?new?RandomAccessFile(sourceFile?“rw“);
//???? RandomAccessFile?of?=?new?RandomAccessFile(outFile?“rw“);
// char?inChar;
// while(sf.getFilePointer()// inChar?=?sf.readChar();
// of.writeChar(inChar);
// System.out.println(inChar);
//// inChar?=?sf.readLine(); //或者整行讀寫,再對String?inChar進行操作
//// of.writeChars(inChar+“?“);
// }
// sf.close();
// of.close();
?

//??solution?3:?assuming?that?we?only?need?to?access?data?from?.txt?files
???????? RandomAccessFile?sf?=?new?RandomAccessFile(sourceFile?“r“);
???? RandomAccessFile?of?=?new?RandomAccessFile(outFile?“rw“);


評論

共有 條評論