国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
壓縮軟件(哈夫曼算法實(shí)現(xiàn)) 項(xiàng)目總結(jié)

壓縮軟件(哈夫曼算法實(shí)現(xiàn)) 項(xiàng)目總結(jié)

文章分類:Java編程
  一、在講具體代碼實(shí)現(xiàn)之前,先給大家普及一下壓縮軟件的相關(guān)知識(shí)
引用
壓縮軟件是利用算法將文件有損或無損地處理,以達(dá)到保留最多文件信息,而令文件體積變小的應(yīng)用軟件。壓縮軟件一般同時(shí)具有解壓縮的功能。壓縮軟件的的基本原理是查找文件內(nèi)的重復(fù)字節(jié),并建立一個(gè)相同字節(jié)的"詞典"文件,并用一個(gè)代碼表示,比如在文件里有幾處有一個(gè)相同的詞"中華人民共和國"用一個(gè)代碼表示并寫入"詞典"文件,這樣就可以達(dá)到縮小文件的目的。常見的壓縮軟件有WinRAR ,好壓(Haozip),WinZip,7-Zip,WinMount,Peazip等等。

        哈夫曼樹作為數(shù)據(jù)結(jié)構(gòu)二叉樹章節(jié)中最為華彩的一部分,有著其獨(dú)特的魅力。給定n個(gè)權(quán)值作為n個(gè)葉子結(jié)點(diǎn),構(gòu)造一棵二叉樹,若帶權(quán)路徑長度達(dá)到最小,這樣的二叉樹便是哈夫曼樹,也稱為最優(yōu)二叉樹?!?
        二、哈夫曼算法 
引用
        Huffman算法是一種基于統(tǒng)計(jì)的壓縮方法。它的本質(zhì)就是對文本文件中的字符進(jìn)行重新編碼,對于使用頻率越高的字符,其編碼也越短。但是任何2個(gè)字符的編碼, 是不能出現(xiàn)向前包含的。也就是說字符A(假設(shè)為00)的編碼的前段,不可能為字符B(則B的編碼不可能為001,因?yàn)檫@里B的編碼中包含了A的前段00,這會(huì)給解碼難帶來不必要的困難,所以這是不允許的)的編碼。經(jīng)過編碼后的文本文件,主要包含2個(gè)部分:Huffman碼表部分和壓縮內(nèi)容部分。解壓縮的時(shí)候,先把Huffman碼表取出來,然后對壓縮內(nèi)容部分各個(gè)字符進(jìn)行逐一解碼,形成源文件。
        哈夫曼編碼生成步驟:
        ①掃描要壓縮的文件,對字符出現(xiàn)的頻率進(jìn)行計(jì)算。
        ②把字符按出現(xiàn)的頻率進(jìn)行排序,組成一個(gè)隊(duì)列。
        ③把出現(xiàn)頻率最低(權(quán)值)的兩個(gè)字符作為葉子節(jié)點(diǎn),它們的權(quán)值之和為根節(jié)點(diǎn)組成一棵樹。
        ④把上面葉子節(jié)點(diǎn)的兩個(gè)字符從隊(duì)列中移除,并把它們組成的根節(jié)點(diǎn)加入到隊(duì)列。
        ⑤把隊(duì)列重新進(jìn)行排序。重復(fù)步驟③④⑤直到隊(duì)列中只有一個(gè)節(jié)點(diǎn)為止。
        ⑥把這棵樹上的根節(jié)點(diǎn)定義為0(可自行定義0或1)左邊為0,右邊為1。這樣就可以得到每個(gè)葉子節(jié)點(diǎn)的哈夫曼編碼了。

        三、編碼流程(大體思路)
        壓縮:
        1、將要壓縮的文件一個(gè)一個(gè)字節(jié)的讀出來即掃描要壓縮的文件,并統(tǒng)計(jì)每個(gè)字節(jié)的權(quán)值即出現(xiàn)的頻率。
        2、以每個(gè)字節(jié)的權(quán)值來構(gòu)造哈夫曼樹,并給每個(gè)字節(jié)進(jìn)行哈夫曼編碼。
        3、將每個(gè)字節(jié)和其對應(yīng)得哈夫曼編碼存放進(jìn)一個(gè)Map中,即碼表。
        4、以這個(gè)碼表為依照,將文件中的所有字節(jié)一一進(jìn)行編碼(生成10字符串),最后在把所有字節(jié)的編碼依次末尾相加合成一個(gè)10字符串。
        5、將這個(gè)10字符串重新組合,8個(gè)為一組,若最后一組不足8個(gè)則補(bǔ)0,并記錄補(bǔ)0的個(gè)數(shù),將每一組的10字符串轉(zhuǎn)化為一個(gè)字節(jié),
并將所有的10字符串合成一個(gè)字節(jié)數(shù)組,數(shù)組的最后一個(gè)元素存放補(bǔ)0的個(gè)數(shù)。
        6、創(chuàng)建一個(gè)壓縮文件,先將碼表的大小寫入文件,再將碼表寫入文件(碼表里還有每個(gè)字節(jié)的哈夫曼編碼長度的信息)。
        7、最后將之前生成的字節(jié)數(shù)組寫入文件(文件的主要信息)。
        解壓縮:
        1、將壓縮的文件同樣一個(gè)一個(gè)字節(jié)的讀出來。
        2、先讀出碼表的大小,再通過碼表的大小讀出碼表,并將碼表的信息存放進(jìn)一個(gè)Map。
        3、再接著讀出后面的所有字節(jié),并轉(zhuǎn)化成一個(gè)10字符串。
        4、通過與碼表的匹配,從10字符串的第一個(gè)字符開始讀,若讀到的子字符串與碼表的某個(gè)字節(jié)的的編碼相同,解壓出相應(yīng)的字節(jié),把該字節(jié)保存起來。
并把上面的子字符串從編碼中刪除,重復(fù)上一步驟,直到該項(xiàng)編碼解析完成,最后將此10字符串還原成原來的文件的一個(gè)個(gè)字節(jié)。
        5、再將這些字節(jié)寫入一個(gè)新的文件,后綴名改成和原來文件一樣,就能打開了。

       
四、核心代碼

1、壓縮文件
Java代碼
  1. /**  
  2.  * 壓縮的文件操作  
  3.  *   
  4.  * @author king  
  5.  *   
  6.  */  
  7. public class CompressFileOption {   
  8.   
  9.     /**  
  10.      * 讀取文件  
  11.      *   
  12.      * @param path  
  13.      *            :文件路徑  
  14.      * @return:將文件的內(nèi)容以字節(jié)數(shù)組的樣式返回  
  15.      */  
  16.     public static byte[] readFile(String path) {   
  17.         byte[] dataByte = null;   
  18.         try {   
  19.             java.io.FileInputStream fis = new java.io.FileInputStream(path);   
  20.             int size = fis.available();// 可讀的字節(jié)數(shù)   
  21.             dataByte = new byte[size];   
  22.             fis.read(dataByte);   
  23.   
  24.         } catch (Exception e) {   
  25.             // TODO Auto-generated catch block   
  26.             e.printStackTrace();   
  27.         }   
  28.         return dataByte;   
  29.     }   
  30.   
  31.     /**  
  32.      * 將碼表的相關(guān)信息寫入文件  
  33.      *   
  34.      * @param fileSize  
  35.      *            :原文件大小  
  36.      * @param map  
  37.      *            :存放碼表的map  
  38.      * @param listCh  
  39.      *            :存放關(guān)鍵碼的字符隊(duì)列  
  40.      * @param path  
  41.      *            :文件路徑  
  42.      * @throws Exception  
  43.      */  
  44.     public static void writeMap(int fileSize,   
  45.             java.util.HashMap<Byte, String> map, List<Byte> listBy, String path)   
  46.             throws Exception {   
  47.   
  48.         java.io.FileOutputStream fos = new java.io.FileOutputStream(path);   
  49.         java.io.DataOutputStream dos = new java.io.DataOutputStream(fos);   
  50.   
  51.         dos.writeInt(fileSize);// 將原文件大小寫入文件   
  52.         int mapSize = map.size();// 碼表的大小   
  53.         dos.writeInt(mapSize);// //將碼表的大小寫入文件   
  54.         for (int i = 0; i < mapSize; i++) {   
  55.             fos.write(listBy.get(i));// 將每個(gè)字節(jié)寫入文件   
  56.             String hfmcode_next = map.get(listBy.get(i));// 得到每個(gè)字節(jié)對應(yīng)的哈夫曼編碼   
  57.             byte codeSize = (byte) hfmcode_next.length();// 每個(gè)字節(jié)對應(yīng)的哈夫曼編碼大小   
  58.             fos.write(codeSize);// 將每個(gè)字節(jié)對應(yīng)的哈夫曼編碼大小寫入文件   
  59.             dos.writeChars(hfmcode_next);// 將每個(gè)字符對應(yīng)的哈夫曼編碼寫入文件   
  60.         }   
  61.         dos.flush();   
  62.         fos.close();   
  63.     }   
  64.   
  65.     /**  
  66.      * 將壓縮好的字節(jié)數(shù)組寫入文件  
  67.      *   
  68.      * @param b  
  69.      *            :壓縮好的字節(jié)數(shù)組  
  70.      * @param path  
  71.      *            :文件路徑  
  72.      */  
  73.     public static void writeFile(byte[] b, String path) {   
  74.   
  75.         try {   
  76.             java.io.FileOutputStream fos = new java.io.FileOutputStream(path,   
  77.                     true);   
  78.             java.io.DataOutputStream dos = new java.io.DataOutputStream(fos);   
  79.             // 寫入字節(jié)數(shù)組的大小   
  80.             dos.writeInt(b.length);   
  81.             fos.write(b);   
  82.             fos.flush();   
  83.             fos.close();   
  84.         } catch (Exception e) {   
  85.             // TODO Auto-generated catch block   
  86.             e.printStackTrace();   
  87.         }   
  88.     }   
  89.   
  90.     /**  
  91.      * 將10字符串轉(zhuǎn)化為一個(gè)字節(jié)  
  92.      *   
  93.      * @param str  
  94.      *            :傳入的字符串  
  95.      * @return:一個(gè)字節(jié)  
  96.      */  
  97.     private byte CharArrayToByte(String str) {   
  98.         char[] c = str.toCharArray();// 將字符串str轉(zhuǎn)化為字符數(shù)組c   
  99.         int len = c.length;   
  100.         byte[] b = new byte[len];   
  101.         byte value = 0;   
  102.         byte value_next;   
  103.         for (int i = 0; i < len; i++) {   
  104.             b[i] = Byte.parseByte(c[i] + "");   
  105.             // System.out.println(b[i]);   
  106.         }   
  107.         for (int i = 0; i < len; i++) {   
  108.             value_next = (byte) (b[i] * Math.pow(2, len - i - 1));// 冪計(jì)算   
  109.             value = (byte) (value + value_next);   
  110.         }   
  111.         return value;   
  112.     }   
  113.   
  114.     /**  
  115.      * 將10字符串以8個(gè)為一組轉(zhuǎn)化為一個(gè)字節(jié)數(shù)組  
  116.      *   
  117.      * @param str  
  118.      * @return  
  119.      */  
  120.     private byte[] StringToByteArray(String str) {   
  121.         char[] c = str.toCharArray();// 將字節(jié)串str轉(zhuǎn)化為字符數(shù)組c   
  122.         int len = c.length;// 字符串字符的個(gè)數(shù)   
  123.         int lenByte;   
  124.         String s = "";   
  125.         char c_next;   
  126.         byte[] b;   
  127.         if (len % 8 == 0) {// 如果字符串的長度能被8整除   
  128.             lenByte = len / 8 + 1;   
  129.             b = new byte[lenByte];   
  130.             for (int i = 0; i < lenByte - 1; i++) {   
  131.                 for (int j = i * 8; j < (i + 1) * 8; j++) {   
  132.                     c_next = c[j];   
  133.                     s = s + c_next;   
  134.                 }   
  135.                 System.out.println("第" + i + "個(gè)字符串:" + s);   
  136.                 b[i] = CharArrayToByte(s);   
  137.                 s = "";   
  138.                 System.out.println("第" + i + "個(gè)字符串轉(zhuǎn)化為字節(jié)后的值:" + b[i]);   
  139.             }   
  140.             b[lenByte - 1] = 0;// 字節(jié)數(shù)組的最后一個(gè)存放補(bǔ)0的個(gè)數(shù)   
  141.         } else {// 如果字符串的長度不能被8整除   
  142.   
  143.             lenByte = len / 8 + 2;   
  144.             b = new byte[lenByte];   
  145.             int remainder = len % 8;// 求出除8的余數(shù)   
  146.             int zeroNum = 8 - remainder;// 補(bǔ)0的個(gè)數(shù)   
  147.             System.out.println("補(bǔ)0數(shù):" + zeroNum);   
  148.             System.out.println("原字符串:" + str);   
  149.             for (int i = 0; i < zeroNum; i++) {   
  150.                 str = str + '0';// 在字符串后面補(bǔ)0   
  151.             }   
  152.             System.out.println("補(bǔ)0后的字符串:" + str);   
  153.             c = str.toCharArray();   
  154.             System.out.println("補(bǔ)0后的字符串的字符個(gè)數(shù):" + c.length);   
  155.             for (int i = 0; i < lenByte - 1; i++) {   
  156.                 for (int j = i * 8; j < (i + 1) * 8; j++) {   
  157.                     c_next = c[j];   
  158.                     s = s + c_next;   
  159.                 }   
  160.                 System.out.println("第" + i + "個(gè)字符串:" + s);   
  161.                 b[i] = CharArrayToByte(s);   
  162.                 s = "";   
  163.                 System.out.println("第" + i + "個(gè)字符串轉(zhuǎn)化為字節(jié)后的值:" + b[i]);   
  164.             }   
  165.             b[lenByte - 1] = (byte) zeroNum;// 字節(jié)數(shù)組的最后一個(gè)存放補(bǔ)0的個(gè)數(shù)   
  166.         }   
  167.         return b;   
  168.     }   
  169.   
  170.     /**  
  171.      * 壓縮文件  
  172.      *   
  173.      * @param path1  
  174.      *            :原文件路徑  
  175.      * @param path2  
  176.      *            :壓縮后的文件路徑  
  177.      * @throws Exception  
  178.      */  
  179.     public void CompressFile(String path1, String path2) throws Exception {   
  180.         // 從文件中得到字節(jié)數(shù)組   
  181.         byte[] b = CompressFileOption.readFile(path1);   
  182.         int b_size = b.length;// 原文件大小   
  183.         byte[] b_compress;// 字節(jié)數(shù)組,存放壓縮的字符串   
  184.   
  185.         String hfmcode = "";// 文件內(nèi)所有字節(jié)的哈夫曼編碼   
  186.         String hfmcode_next;// 文件中每個(gè)字節(jié)的哈夫曼編碼   
  187.         // 計(jì)算字符串中每個(gè)字節(jié)的權(quán)值,并返回一個(gè)存放字節(jié)和它對應(yīng)權(quán)值的節(jié)點(diǎn)隊(duì)列   
  188.         List<TreeNode> list = calWeight.calweight(b);   
  189.         int size = list.size();   
  190.         Huffman hfm = new Huffman();   
  191.         // 構(gòu)建哈夫曼樹并返回根節(jié)點(diǎn)   
  192.         TreeNode root = hfm.createHuffman(list);   
  193.         // 創(chuàng)建哈夫曼編碼使其與字符一一對應(yīng)   
  194.         hfm.createHfmCode(root, "");   
  195.   
  196.         java.util.HashMap<Byte, String> map = hfm.getMap();// 得到碼表   
  197.         List<Byte> listBy = hfm.getList();// 得到存放關(guān)鍵碼隊(duì)列   
  198.   
  199.         System.out.println("mapsize---->:" + map.size());   
  200.         System.out.println("b---->:" + b.length);   
  201.         for (int i = 0; i < b_size; i++) {   
  202.             // 得到每個(gè)字節(jié)的哈夫曼編碼   
  203.             hfmcode_next = map.get(b[i]);   
  204.             System.out.println("第"+i+"個(gè): " + b[i] + "的編碼:" + hfmcode_next);   
  205.             hfmcode = hfmcode + hfmcode_next;// 將每個(gè)字節(jié)的哈夫曼編碼依次相加為一個(gè)01字符串   
  206.         }   
  207.         System.out.println("01串大?。? + hfmcode.length());   
  208.         System.out.println("01串:" + hfmcode);   
  209.         char[] ch = hfmcode.toCharArray();   
  210.         System.out.println("01串的大?。? + ch.length);   
  211.   
  212.         b_compress = StringToByteArray(hfmcode);// 得到字節(jié)數(shù)組   
  213.         for (int i = 0; i < b_compress.length; i++) {   
  214.             System.out.println("第" + i + "個(gè)字節(jié)" + b_compress[i]);   
  215.         }   
  216.         // 將文件大小和碼表相關(guān)信息寫入文件   
  217.         writeMap(b_size, map, listBy, path2);   
  218.         // 將字節(jié)數(shù)組寫入文件   
  219.         writeFile(b_compress, path2);   
  220.     }  


2、解壓縮文件
Java代碼
  1. /**  
  2.  * 解壓縮的文件操作  
  3.  *   
  4.  * @author king  
  5.  *   
  6.  */  
  7. public class UncompressFileOption {   
  8.   
  9.     public static long fileSize;   
  10.   
  11.     /**  
  12.      * 將8位10字符串前面缺0的補(bǔ)上0  
  13.      *   
  14.      * @param str  
  15.      * @return  
  16.      */  
  17.     private String addZero(String str) {   
  18.         int strLen = str.length();   
  19.         int zeroNum;   
  20.         if (strLen < 8) {// 若字符串長度小于8則補(bǔ)0   
  21.             zeroNum = 8 - strLen;   
  22.             for (int i = 0; i < zeroNum; i++) {   
  23.                 str = "0" + str;   
  24.             }   
  25.         }   
  26.         return str;   
  27.     }   
  28.   
  29.     /**  
  30.      * 將整型數(shù)組還原成之前的10串,即文件內(nèi)容的哈夫曼編碼  
  31.      *   
  32.      * @param n  
  33.      * @return  
  34.      */  
  35.     private String InttoBinaryString(int[] n) {   
  36.         int len = n.length;   
  37.         String[] s = new String[len];// 一個(gè)字符串?dāng)?shù)組存放二進(jìn)制數(shù)據(jù)   
  38.         String BinaryStr = "";   
  39.         for (int i = 0; i < len - 1; i++) {   
  40.             s[i] = Integer.toBinaryString(n[i]);   
  41.             s[i] = addZero(s[i]);   
  42.             BinaryStr = BinaryStr + s[i];   
  43.         }   
  44.         System.out.println("二進(jìn)制形式表示:" + BinaryStr);   
  45.         int BinaryStrLen = BinaryStr.length();// 得到為減0前的字符串大小   
  46.         int zeroSub = n[len - 1];// 之前在末尾補(bǔ)0的個(gè)數(shù),現(xiàn)在減去   
  47.         System.out.println("減0前的字符串大小:" + BinaryStrLen);   
  48.         System.out.println("需要在字符串末尾減0的個(gè)數(shù)表示:" + zeroSub);   
  49.         BinaryStr = BinaryStr.substring(0, BinaryStrLen - zeroSub);   
  50.         System.out.println("減0后的字符串大小:" + (BinaryStrLen - zeroSub));   
  51.         System.out.println("減0后的二進(jìn)制形式表示:" + BinaryStr);   
  52.         return BinaryStr;   
  53.     }   
  54.   
  55.     /**  
  56.      * 字符串匹配,判斷字符串child是否為parent的前子串  
  57.      *   
  58.      * @param parent  
  59.      * @param child  
  60.      * @return  
  61.      */  
  62.     private boolean StringMatch(String parent, String child) {   
  63.   
  64.         char[] p = parent.toCharArray();   
  65.         char[] c = child.toCharArray();   
  66.         // System.out.println("數(shù)組p的長度:" + p.length);   
  67.         // System.out.println("數(shù)組c的長度:" + c.length);   
  68.         boolean b = false;   
  69.         for (int i = 0; i < c.length; i++) {   
  70.             if (c[i] == p[i]) {   
  71.                 b = true;   
  72.             } else {   
  73.                 b = false;   
  74.                 break;// 有一個(gè)字符不匹配則跳出循環(huán)   
  75.             }   
  76.         }   
  77.         return b;   
  78.     }   
  79.   
  80.     /**  
  81.      * 解壓縮文件  
  82.      *   
  83.      * @param path2  
  84.      *            :壓縮后的文件路徑  
  85.      * @param path3  
  86.      *            :解壓縮后的文件路徑  
  87.      * @throws Exception  
  88.      */  
  89.     public void UncompressFile(String path2, String path3) throws Exception {   
  90.   
  91.         HashMap<Byte, String> map = new HashMap<Byte, String>();   
  92.         java.io.FileInputStream fis = new java.io.FileInputStream(path2);   
  93.         java.io.DataInputStream dis = new java.io.DataInputStream(fis);   
  94.   
  95.         java.io.FileOutputStream fos = new java.io.FileOutputStream(path3);   
  96.   
  97.         fileSize = dis.readInt();// 得到原文件的大小   
  98.         int mapSize = dis.readInt();// 得到碼表的大小   
  99.         byte[] mapKey = new byte[mapSize];// 創(chuàng)建一個(gè)字符數(shù)組,存放碼表中的字節(jié)   
  100.         byte codeSize;// 每個(gè)字節(jié)對應(yīng)的哈夫曼編碼大小   
  101.         String hfmcode_next = "";   
  102.         // 讀取碼表內(nèi)容   
  103.         for (int i = 0; i < mapSize; i++) {   
  104.             mapKey[i] = (byte) fis.read();// 得到第i個(gè)字節(jié)   
  105.             codeSize = (byte) fis.read();// 得到每個(gè)字節(jié)對應(yīng)的哈夫曼編碼大小   
  106.             char[] codeChar = new char[codeSize];   
  107.             for (int j = 0; j < codeSize; j++) {   
  108.                 codeChar[j] = dis.readChar();   
  109.                 hfmcode_next = hfmcode_next + codeChar[j];   
  110.             }   
  111.             map.put(mapKey[i], hfmcode_next);// 將鍵值對放入Map中   
  112.             hfmcode_next = "";   
  113.         }   
  114.         int len = dis.readInt();// 得到壓縮好的字節(jié)數(shù)組的大小   
  115.         System.out.println("壓縮好的字節(jié)數(shù)組的大小: " + len);   
  116.         byte[] b = new byte[len];// 字節(jié)數(shù)組,存放壓縮的字節(jié)串   
  117.         int[] n = new int[len];// 整型數(shù)組   
  118.         fis.read(b);// 得到壓縮好的文件的字節(jié)數(shù)組   
  119.         for (int i = 0; i < b.length; i++) {   
  120.             System.out.println("第" + i + "個(gè)字節(jié):" + b[i]);   
  121.             // 將字節(jié)還原成原來的整型數(shù)據(jù)   
  122.             if (b[i] < 0) {   
  123.                 n[i] = b[i] + 256;   
  124.             } else {   
  125.                 n[i] = b[i];   
  126.             }   
  127.             System.out.println("第" + i + "個(gè)字節(jié)的整型表示:" + n[i]);   
  128.         }   
  129.         String formerStr = InttoBinaryString(n);// 得到原10串   
  130.   
  131.         System.out.println("formerStr:" + formerStr);   
  132.         int size = map.size();   
  133.         System.out.println("mapsize:" + size);   
  134.   
  135.         int endIndex = formerStr.length();   
  136.         System.out.println("endIndex:" + endIndex);   
  137.         int beginIndex;   
  138.   
  139.         // byte[] fileData = new byte[fileSize];   
  140.         int count = 0;// 記錄文件當(dāng)前是第幾個(gè)字節(jié)   
  141.   
  142.         while (!formerStr.isEmpty()) {// 如果字符串不為空   
  143.   
  144.             String child;   
  145.             for (int i = 0; i < mapKey.length; i++) {   
  146.                 child = map.get(mapKey[i]);   
  147.                 if (formerStr.isEmpty()) {// 若字符串為空   
  148.                     break;   
  149.                 }   
  150.                 if (StringMatch(formerStr, child)) {// 若匹配   
  151.                     // 一個(gè)字節(jié)字節(jié)的寫入文件   
  152.                     fos.write(mapKey[i]);   
  153.                     count++;   
  154.                     beginIndex = child.length();   
  155.                     formerStr = formerStr.substring(beginIndex, endIndex);   
  156.                     endIndex = endIndex - beginIndex;   
  157.                 }   
  158.             }   
  159.         }   
  160.         fos.flush();   
  161.         fos.close();   
  162.     }  


五、項(xiàng)目展示

1.壓縮軟件界面


2.瀏覽要壓縮的文件并指定壓縮后的文件路徑


3.壓縮文本文件的效果


4.解壓縮文件及效果




5.壓縮bmp格式圖片文件效果明顯,但是壓縮和解壓的時(shí)間都很長,需改進(jìn)

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
把byte轉(zhuǎn)化成2進(jìn)制字符串
C# 計(jì)算文件的 Hash 值
使用Java MD5 為文件和字符串加密
Jsp頁面實(shí)現(xiàn)文件上傳下載 -下載
精確截取字符串
16進(jìn)制字符串與byte數(shù)組互轉(zhuǎn)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服