‘壹’ 在.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压缩是比特级别的压缩,这样按照字节分割肯定会出现错误,况且,一般必要的压缩参数常量和基本用表都在压缩数据前段,后段没有,没办法单独解压.