资源简介
1.已经取得了root权限的Android手机一部(比如我自己来说,就是Note 2国行单卡版N7100和HTCNew One电信双卡版802D)。
2.已经安装了busybox(注意:必须安装在/system/bin目录下,而不是/system/xbin,可以使用“Busybox Pro”进行安装)。
代码片段和文件信息
/*
* xz_pipe_comp.c
* A simple example of pipe-only xz compressor implementation.
* version: 2010-07-12 - by Daniel Mealha Cabrita
* Not copyrighted -- provided to the public domain.
*
* Compiling:
* link with liblzma. GCC example:
* $ gcc -llzma xz_pipe_comp.c -o xz_pipe_comp
*
* Usage example:
* $ cat some_file | ./xz_pipe_comp > some_file.xz
*/
#include
#include
#include
#include
#include
/* COMPRESSION SETTINGS */
/* analogous to xz CLI options: -0 to -9 */
#define COMPRESSION_LEVEL 6
/* boolean setting analogous to xz CLI option: -e */
#define COMPRESSION_EXTREME true
/* see: /usr/include/lzma/check.h LZMA_CHECK_* */
#define INTEGRITY_CHECK LZMA_CHECK_CRC64
/* read/write buffer sizes */
#define IN_BUF_MAX 4096
#define OUT_BUF_MAX 4096
/* error codes */
#define RET_OK 0
#define RET_ERROR_INIT 1
#define RET_ERROR_INPUT 2
#define RET_ERROR_OUTPUT 3
#define RET_ERROR_COMPRESSION 4
/* note: in_file and out_file must be open already */
int xz_compress (FILE *in_file FILE *out_file)
{
uint32_t preset = COMPRESSION_LEVEL | (COMPRESSION_EXTREME ? LZMA_PRESET_EXTREME : 0);
lzma_check check = INTEGRITY_CHECK;
lzma_stream strm = LZMA_STREAM_INIT; /* alloc and init lzma_stream struct */
uint8_t in_buf [IN_BUF_MAX];
uint8_t out_buf [OUT_BUF_MAX];
size_t in_len; /* length of useful data in in_buf */
size_t out_len; /* length of useful data in out_buf */
bool in_finished = false;
bool out_finished = false;
lzma_action action;
lzma_ret ret_xz;
int ret;
ret = RET_OK;
/* initialize xz encoder */
ret_xz = lzma_easy_encoder (&strm preset check);
if (ret_xz != LZMA_OK) {
fprintf (stderr “lzma_easy_encoder error: %d\n“ (int) ret_xz);
return RET_ERROR_INIT;
}
while ((! in_finished) && (! out_finished)) {
/* read incoming data */
in_len = fread (in_buf 1 IN_BUF_MAX in_file);
if (feof (in_file)) {
in_finished = true;
}
if (ferror (in_file)) {
in_finished = true;
ret = RET_ERROR_INPUT;
}
strm.next_in = in_buf;
strm.avail_in = in_len;
/* if no more data from in_buf flushes the
internal xz buffers and closes the xz data
with LZMA_FINISH */
action = in_finished ? LZMA_FINISH : LZMA_RUN;
/* loop until there‘s no pending compressed output */
do {
/* out_buf is clean at this point */
strm.next_out = out_buf;
strm.avail_out = OUT_BUF_MAX;
/* compress data */
ret_xz = lzma_code (&strm action);
if ((ret_xz != LZMA_OK) && (ret_xz != LZMA_STREAM_END)) {
fprintf (stderr “lzma_code error: %d\n“ (int) ret_xz);
out_finished = true;
ret = RET_ERROR_COMPRESSION;
} else {
/* write compressed data */
out_len = OUT_BUF_MAX - strm.avail_out;
fwrite (out_buf 1 out_len out_file);
if (ferror (out_file)) {
out_finished = true;
ret = RET_ERROR_OUTPUT;
}
}
} while (strm.avail_out == 0);
}
lzma_end (&strm);
return ret;
}
int main ()
{
int ret;
ret = xz
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 821600 2014-01-26 11:55 cygwin\adb.exe
文件 102760 2013-11-15 16:46 cygwin\AdbWinApi.dll
文件 67440 2013-11-15 16:46 cygwin\AdbWinUsbApi.dll
文件 151043 2012-07-13 02:34 cygwin\bin\a2p.exe
文件 18958 2012-04-24 19:52 cygwin\bin\addftinfo.exe
文件 165866 2012-04-24 19:52 cygwin\bin\afmtodit
文件 1786 2011-11-15 06:31 cygwin\bin\apropos
文件 18446 2012-02-06 19:29 cygwin\bin\arch.exe
文件 90126 2011-12-04 03:56 cygwin\bin\ash.exe
....S.. 19 2003-01-01 07:40 cygwin\bin\awk
文件 9742 2012-04-14 07:20 cygwin\bin\banner.exe
文件 26126 2012-02-06 19:29 cygwin\bin\ba
文件 17422 2012-02-06 19:29 cygwin\bin\ba
文件 536078 2011-02-26 04:31 cygwin\bin\bash.exe
文件 6942 2011-02-26 04:30 cygwin\bin\bashbug
文件 27662 2011-05-22 00:47 cygwin\bin\bunzip2.exe
文件 27662 2011-05-22 00:47 cygwin\bin\bzcat.exe
....S.. 17 2003-01-01 07:40 cygwin\bin\bzcmp
文件 2128 2011-05-22 00:46 cygwin\bin\bzdiff
....S.. 17 2003-01-01 07:40 cygwin\bin\bzegrep
....S.. 17 2003-01-01 07:40 cygwin\bin\bzfgrep
文件 3642 2011-05-22 00:46 cygwin\bin\bzgrep
文件 27662 2011-05-22 00:47 cygwin\bin\bzip2.exe
文件 9230 2011-05-22 00:47 cygwin\bin\bzip2recover.exe
....S.. 17 2003-01-01 07:40 cygwin\bin\bzless
文件 1297 2011-05-22 00:46 cygwin\bin\bzmore
文件 36607 2012-07-13 02:22 cygwin\bin\c2ph
文件 20509 2012-11-05 07:47 cygwin\bin\cal.exe
文件 36878 2012-02-06 19:29 cygwin\bin\cat.exe
文件 40974 2012-02-06 19:29 cygwin\bin\chcon.exe
............此处省略10052个文件信息
相关资源
- 适配uiautomatorviewer适配Android 9.0-10.0的
- geotools所需jar包合集
- AndroidCarrierClassTools_v3.6_20190401
- AndroidCarrierClassTools 航母解包打包工具
- Was+Tools+beta+2.0.1.jar
- Android SDK Tools 24.0.2官网最新
- wx-tools-2.0.0.jar
- 游览Wdf及was等文件\\Was Tools beta 2.0.1
- tools-1.8.0.jar
- weixin-java-tools-1.3.3(jdk1.6版本编译)
- itcast-tools-1.4.2.jar
- org.greggordon.tools.jar
- HttpTools2.4
- android sdk tools 25.0.1
- apktools 2.3.3
- apktool_2.0.0rc4.jar-最新版APKtools
- org.dtools.javaini-v1.1.0.jar
- 关于android7.1 做ota差分升级提示没有
- 2款不错的Java反编译工具(jd-gui 0.2.
- jeesite-module-core-4.0和devtools-4.0架包
- tools-1.8.0_181.jar.zip
- tools-1.8.0.jar包
- Android Sdk Platform-tools 28最新版本
- com-sun-tools-visualvm-modules-visualgc-2.1.2
- i2c-tools_4.0.zip
- maven,jmxtools-1.2.1.jar,jmxri-1.2.1.jar
- org.apache.tools.jar
- AndroidSDK下/platform-tools/api/annotations.z
- dex-tools-2.1-SNAPSHOT.zip
- Development.apkAndroid Dev Tools
评论
共有 条评论