『壹』 在.net平台上進行gzip壓縮後的字元串通過webservice傳遞到android客戶端,在客戶端解壓縮為什麼會出現亂碼
普通的壓縮都是形成同一種編碼的字元串
這個應該是解碼出錯的原因,參考下.NET的Encoding.default的編碼類型和java的Encoding.default的編碼類型
『貳』 安卓,選中壓縮文件-輸入解壓密碼-解壓-完成。什麼軟體類似這樣的操作步驟
ZArchiver(超級壓縮管理器)是一款管理壓縮文件的應用程序,它提供了簡潔高效的用戶界面以及多種壓縮格式的支持,是Android系統上功能最強的壓縮文件管理器之一。
主要功能:
- 創建多種格式的壓縮文件:7z、ZIP、TAR、BZIP2、GZIP、XZ
- 解壓多種格式的壓縮文件:7z、ZIP、RAR、BZIP2、GZIP、XZ、ISO、TAR、JAR、CAB、LZH、LZMA、XAR
- 查看多種格式的壓縮文件內容:7z、ZIP、RAR、BZIP2、GZIP、XZ、ISO、TAR、JAR、CAB、LZH、LZMA、XAR
- 創建和解壓受密碼保護的壓縮文件
- 編輯壓縮文件:將文件添加到壓縮文件中或從壓縮文件中刪除文件
- 創建和解壓分卷壓縮文件
- 從壓縮文件中直接打開文件
- 顯示縮略圖和APK圖標選項
- 支持多線程(在多核心處理器上很有用)
- 支持Unicode文件名(UTF-8)
『叄』 如何在Android系統中使用gzip進行數據傳遞
HTTP協議上的GZIP編碼是一種用來改進WEB應用程序性能的技術。大流量的WEB站點常常使用GZIP壓縮技術來減少文件大小,減少文件大小有兩個明顯的好處,一是可以減少存儲空間,二是通過網路傳輸文件時,可以減少傳輸的時間。作者在寫這篇博客時經過測試,4.4MB的文本數據經過Gzip傳輸到客戶端之後變為392KB,壓縮效率極高。
一.服務端
服務端有2種方式去壓縮,一種可以自己壓縮,但是更推薦第二種方式,用PrintWriter作為輸出流,工具類代碼如下
/**
* 判斷瀏覽器是否支持 gzip 壓縮
* @param req
* @return boolean 值
*/
public static boolean isGzipSupport(HttpServletRequest req) {
String headEncoding = req.getHeader(「accept-encoding」);
if (headEncoding == null || (headEncoding.indexOf(「gzip」) == -1)) { // 客戶端 不支持 gzip
return false;
} else { // 支持 gzip 壓縮
return true;
}
}
/**
* 創建 以 gzip 格式 輸出的 PrintWriter 對象,如果瀏覽器不支持 gzip 格式,則創建普通的 PrintWriter 對象,
* @param req
* @param resp
* @return
* @throws IOException
*/
public static PrintWriter createGzipPw(HttpServletRequest req, HttpServletResponse resp) throws IOException {
PrintWriter pw = null;
if (isGzipSupport(req)) { // 支持 gzip 壓縮
pw = new PrintWriter(new GZIPOutputStream(resp.getOutputStream()));
// 在 header 中設置返回類型為 gzip
resp.setHeader(「content-encoding」, 「gzip」);
} else { // // 客戶端 不支持 gzip
pw = resp.getWriter();
}
return pw;
}
servlet代碼如下:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setCharacterEncoding(「utf-8″);
response.setHeader(「Content-Encoding」, 「gzip」);
String ret = 「{「ContentLayer」:{「title」:」內容層」},」PageLink」:{「title」:」頁面跳轉」},」WebBrowser」:{「title」:」瀏覽器」},」
+ 「」InlinePage」:{「title」:」內嵌頁面」},」VideoComp」:{「title」:」視頻」},」
+ 「」PopButton」:{「title」:」內容開關」},」ZoomingPic」:{「title」:」縮放大圖」},」
+ 「」Rotate360″:{「title」:」360度旋轉」}}」;
PrintWriter pw = new PrintWriter(new GZIPOutputStream(response.getOutputStream()));
pw.write(ret);
pw.close();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
在代理軟體中跟蹤到的數據如下:
‹«VrÎÏ+IÍ+ñI¬L-R²ªV*É,ÉIU²R:rëÄÝM•ju」ÓS}2ó²『e/m>üìÌë«@òá©INEùåŨúŸ¬?pàØw¼g^Nf^*ÈTóo™R–™』šïœŸ[€¬àÔåc[ÁÖç8•–」äç¡»nÿª7@
¢òós3óÒ2「『Uœþºýè–Ïg÷€Tå—$–¤› +r·¸ðä‡Zh¤†ˆ
實際數據如下:
{「ContentLayer」:{「title」:」內容層」},」PageLink」:{「title」:」頁面跳轉」},」WebBrowser」:{「title」:」瀏覽器」},」InlinePage」:{「title」:」內嵌頁面」},」VideoComp」:{「title」:」視頻」},」PopButton」:{「title」:」內容開關」},」ZoomingPic」:{「title」:」縮放大圖」},」Rotate360″:{「title」:」360度旋轉」}}
『肆』 android gzip解壓怎麼去除中間多餘數據
如果是在linux下,用gunzip 文件名 解壓 如果是windows下,直接用winrar或其他解壓工具解壓即可
『伍』 怎樣調用Gzip將指定的文件進行壓縮並備份(
命令: gzip語法:gzip [選項] 壓縮(解壓縮)的文件名 -c 將輸出寫到標准輸出上,並保留原有文件。 -d 將壓縮文件解壓。 -l 對每個壓縮文件,顯示下列欄位: (1)壓縮文件的大小 (2)未壓縮文件的大小 (3)壓縮比 未壓縮文件的名字 -r 遞...
『陸』 7z文件手機怎麼解壓
打開【QQ瀏覽器】,點擊界面下方的【文件】,選擇【壓縮包】,打開要解壓的7z文件,點擊【解壓全部文件】或文件旁邊的解壓,再點擊【去看看】即可查看文件。
手機是可以在較廣范圍內使用的攜帶型電話終端,全稱為行動電話或無線電話,最初只是一種通訊工具,早期在中國有「大哥大」的俗稱。
手機最早是由美國貝爾實驗室於1940年製造的戰地行動電話機發展而來,後美國摩托羅拉工程師馬丁·庫帕於1973年發明了世界上第一部商業化手機。現代的手機除了典型的電話功能外,還包含了照相機、GPS和連接互聯網等更多功能,它們都概括性地被稱作智能手機。
『柒』 安卓手機怎麼解壓壓縮包ZIP,RAR和tar格式文件及打包
.網路搜索7-zip,第一個條目,下載並安裝.
2.在桌面新建一個test測試文件夾,右擊,按下圖所示選擇菜單.
3.這里只需要改壓縮格式參數為tar,就會成一個test.tar,如下圖.
4.如果只是需要生成tar那麼就成功了,接下來繼續生成gz包。
生成gz包的重點是要在tar的格式的文件上右擊,可以理解為gz包依賴tar包。
這里右擊test.tar
5.打開壓縮界面,再次選擇壓縮格式,選擇gzip格式,然後就生成test.tar.gz包了.
6.成功生成的tar.gz表.
可以在linux下使用 tar -zxvf test.tar.gz 來解壓縮.
『捌』 gzip怎麼壓縮和怎麼解壓縮文件到其他目錄
解決:gzip -c test.txt > /root/test.gz,文件流重定向,解壓也是,gunzip -c /root/test.gz > ./test.txt
經驗:更常用的命令tar同樣可以解壓*.gz,參數為-c
附gzip幫助文件
GZIP(1) General Commands Manual GZIP(1)
NAME
gzip, gunzip, zcat - compress or expand files
SYNOPSIS
gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ]
gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name ... ]
zcat [ -fhLV ] [ name ... ]
OPTIONS
-a --ascii
Ascii text mode: convert end-of-lines using local conventions.
This option is supported only on some non-Unix systems. For
MSDOS, CR LF is converted to LF when compressing, and LF is con‐
verted to CR LF when decompressing.
-c --stdout --to-stdout
Write output on standard output; keep original files unchanged.
If there are several input files, the output consists of a
sequence of independently compressed members. To obtain better
compression, concatenate all input files before compressing
them.
-d --decompress --uncompress
Decompress.
-f --force
Force compression or decompression even if the file has multiple
links or the corresponding file already exists, or if the com‐
pressed data is read from or written to a terminal. If the input
data is not in a format recognized by gzip, and if the option
--stdout is also given, the input data without change to
the standard output: let zcat behave as cat. If -f is not
given, and when not running in the background, gzip prompts to
verify whether an existing file should be overwritten.
-h --help
Display a help screen and quit.
-l --list
For each compressed file, list the following fields:
compressed size: size of the compressed file
uncompressed size: size of the uncompressed file
ratio: compression ratio (0.0% if unknown)
uncompressed_name: name of the uncompressed file
The uncompressed size is given as -1 for files not in gzip for‐
mat, such as compressed .Z files. To get the uncompressed size
for such a file, you can use:
zcat file.Z | wc -c
In combination with the --verbose option, the following fields
are also displayed:
method: compression method
crc: the 32-bit CRC of the uncompressed data
date & time: time stamp for the uncompressed file
The compression methods currently supported are deflate, com‐
press, lzh (SCO compress -H) and pack. The crc is given as
ffffffff for a file not in gzip format.
With --name, the uncompressed name, date and time are those
stored within the compress file if present.
With --verbose, the size totals and compression ratio for all
files is also displayed, unless some sizes are unknown. With
--quiet, the title and totals lines are not displayed.
-L --license
Display the gzip license and quit.
-n --no-name
When compressing, do not save the original file name and time
stamp by default. (The original name is always saved if the name
had to be truncated.) When decompressing, do not restore the
original file name if present (remove only the gzip suffix from
the compressed file name) and do not restore the original time
stamp if present ( it from the compressed file). This option
is the default when decompressing.
-N --name
When compressing, always save the original file name and time
stamp; this is the default. When decompressing, restore the
original file name and time stamp if present. This option is
useful on systems which have a limit on file name length or when
the time stamp has been lost after a file transfer.
-q --quiet
Suppress all warnings.
-r --recursive
Travel the directory structure recursively. If any of the file
names specified on the command line are directories, gzip will
descend into the directory and compress all the files it finds
there (or decompress them in the case of gunzip ).
-S .suf --suffix .suf
When compressing, use suffix .suf instead of .gz. Any non-empty
suffix can be given, but suffixes other than .z and .gz should
be avoided to avoid confusion when files are transferred to
other systems.
When decompressing, add .suf to the beginning of the list of
suffixes to try, when deriving an output file name from an input
file name.
pack(1).
-t --test
Test. Check the compressed file integrity.
-v --verbose
Verbose. Display the name and percentage rection for each file
compressed or decompressed.
-V --version
Version. Display the version number and compilation options then
quit.
-# --fast --best
Regulate the speed of compression using the specified digit #,
where -1 or --fast indicates the fastest compression method
(less compression) and -9 or --best indicates the slowest com‐
pression method (best compression). The default compression
level is -6 (that is, biased towards high compression at expense
of speed).
『玖』 安卓下的split.1 split.2等等分割文件如何解壓
安卓下的split.1 split.2等等分割文件解壓方法:
1.首先下載手機端的解壓工具ZArchiver;
2.安裝完成後,軟體界面如圖所示,確認安裝正確。軟體會自動顯示所有的文件目錄;
『拾』 gzip分段解壓縮
應該不能,據我所知,gzip或deflate壓縮是比特級別的壓縮,這樣按照位元組分割肯定會出現錯誤,況且,一般必要的壓縮參數常量和基本用表都在壓縮數據前段,後段沒有,沒辦法單獨解壓.