@@ -4,10 +4,10 @@ Snzip, a compression/decompression tool based on snappy.
4
4
What is snzip.
5
5
--------------
6
6
7
- Snzip is one of command line tools using [ snappy] [ ] . This supports five types of
8
- file formats; [ framing-format] [ ] , [ old framing-format] [ ] and obsolete three formats
9
- used by snzip, [ snappy-java] [ ] and [ snappy-in-java] [ ] before official framing-format
10
- was defined. The default format is [ framing-format] [ ] .
7
+ Snzip is one of command line tools using [ snappy] [ ] . This supports several file
8
+ formats; [ framing-format] [ ] , [ old framing-format] [ ] , [ hadoop-snappy format ] [ ] , [ raw format ] [ ]
9
+ and obsolete three formats used by snzip, [ snappy-java] [ ] and [ snappy-in-java] [ ]
10
+ before official framing-format was defined. The default format is [ framing-format] [ ] .
11
11
12
12
Notable Changes
13
13
---------------
@@ -21,11 +21,11 @@ Installation
21
21
22
22
### Install from a tar-ball
23
23
24
- Download snzip-1.0.2 .tar.gz from https://bintray.com/kubo/generic/snzip ,
24
+ Download snzip-1.0.3 .tar.gz from https://bintray.com/kubo/generic/snzip ,
25
25
uncompress and untar it, and run configure.
26
26
27
- tar xvfz snzip-1.0.2 .tar.gz
28
- cd snzip-1.0.2
27
+ tar xvfz snzip-1.0.3 .tar.gz
28
+ cd snzip-1.0.3
29
29
./configure
30
30
31
31
If you didn't install snappy under ` /usr ` or ` /usr/local ` , you need to specify
@@ -40,8 +40,8 @@ the location by `--with-snappy` as follows.
40
40
cd ..
41
41
42
42
# install snzip
43
- tar xvfz snzip-1.0.2 .tar.gz
44
- cd snzip-1.0.2
43
+ tar xvfz snzip-1.0.3 .tar.gz
44
+ cd snzip-1.0.3
45
45
./configure --with-snappy=/usr/local/snappy
46
46
47
47
You can use ` --with-default-format ` to change the default compression format.
@@ -50,12 +50,12 @@ You can use `--with-default-format` to change the default compression format.
50
50
51
51
### Install as a rpm package
52
52
53
- We don't provide rpm packages. You need to download snzip-1.0.2 .tar.gz
53
+ We don't provide rpm packages. You need to download snzip-1.0.3 .tar.gz
54
54
from https://bintray.com/kubo/generic/snzip , create a rpm package as follows and
55
55
install it.
56
56
57
57
# The rpm package will be created under $HOME/rpmbuild/RPMS.
58
- rpmbuild -tb snzip-1.0.2 .tar.gz
58
+ rpmbuild -tb snzip-1.0.3 .tar.gz
59
59
60
60
### Install from the latest source
61
61
@@ -68,7 +68,7 @@ To use source code in the github repository.
68
68
69
69
### Install a Windows package.
70
70
71
- Download ` snzip-1.0.2 -win32.zip ` or ` snzip-1.0.2 -win64.zip ` from
71
+ Download ` snzip-1.0.3 -win32.zip ` or ` snzip-1.0.3 -win64.zip ` from
72
72
https://bintray.com/kubo/generic/snzip and copy ` snzip.exe ` and ` snunzip.exe `
73
73
to a directory in the PATH environment variable.
74
74
80
80
snzip file.tar
81
81
82
82
Compressed file name is ` file.tar.sz ` and the original file is deleted.
83
- Timestamp, mode and permissions are not changed as possible as it can.
83
+ The file attributes such as timestamp, mode and permissions are not changed
84
+ as possible as it can.
84
85
85
86
The compressed file's format is [ framing-format] [ ] . You need to add an option ` -t snappy-java ` or
86
87
` -t snappy-in-java ` to use other formats.
114
115
snunzip file.tar.sz
115
116
116
117
Uncompressed file name is ` file.tar ` and the original file is deleted.
117
- Timestamp, mode and permissions are not changed as possible as it can.
118
+ The file attributes such as timestamp, mode and permissions are not changed
119
+ as possible as it can.
118
120
119
121
If the program name includes ` un ` such as ` snunzip ` , it acts as ` -d ` is set.
120
122
@@ -136,9 +138,8 @@ If the program name includes `cat` such as snzcat, it acts as `-dc` is set.
136
138
Raw format
137
139
----------
138
140
139
- Note: This feature will be added in snzip 1.0.3.
140
-
141
- Unlike other formats, the raw format has a few limitations:
141
+ Raw format is native format of snappy.
142
+ Unlike other formats, there are a few limitations:
142
143
(1) The total data length before compression must be known on compression.
143
144
(2) Automatic file format detection doesn't work on uncompression.
144
145
(3) The raw format support is enabled only when snzip is compiled for snappy 1.1.3 or upper.
@@ -158,7 +159,7 @@ However the following command doesn't work.
158
159
cat file.tar | snzip -t raw > file.tar.raw
159
160
160
161
It uses a pipe. snzip cannot get the total length before compression.
161
- The totel length must be specified by the ` -s ` option in this case.
162
+ The total length must be specified by the ` -s ` option in this case.
162
163
163
164
cat file.tar | snzip -t raw -s "size of file.tar" > file.tar.raw
164
165
173
174
You need to set the ` -t raw ` option to tell snzip the format of the
174
175
file to be uncompressed.
175
176
177
+ Hadoop-snappy format
178
+ --------------------
179
+
180
+ Hadoop-snappy format is one of the compression formats used in Hadoop.
181
+ It uses its own framing format as follows:
182
+
183
+ * A compressed file consists of one or more blocks.
184
+ * A block consists of uncompressed length (big endian 4 byte integer) and one or more subblocks.
185
+ * A subblock consists of compressed length (big endian 4 byte integer) and raw compressed data.
186
+
187
+ ### To compress a file:
188
+
189
+ snzip -t hadoop-snappy file_name
190
+
191
+ The default block size used by ` snzip ` for hadoop-snappy format is 256k.
192
+ It is same with the default value of the ` io.compression.codec.snappy.buffersize `
193
+ parameter. If the block size used by ` snzip ` is larger than the parameter,
194
+ you would get an InternalError ` Could not decompress data. Buffer length is too small `
195
+ while hadoop is reading a file compressed by snzip. You need to change the block
196
+ size by the ` -b ` option as follows if you get the error.
197
+
198
+ # if io.compression.codec.snappy.buffersize is 32768
199
+ snzip -t hadoop-snappy -b 32768 file_name_to_be_compressed
200
+
201
+ ### To uncompress a file:
202
+
203
+ snzip compressed_file.snappy
204
+
205
+ The file format is guessed by the first 8 bytes of the file.
206
+
176
207
SNZ File format
177
208
---------------
178
209
@@ -207,3 +238,5 @@ License
207
238
[ old framing-format ] : https://github.com/google/snappy/blob/0755c815197dacc77d8971ae917c86d7aa96bf8e/framing_format.txt
208
239
[ snappy-java ] : https://github.com/xerial/snappy-java
209
240
[ snappy-in-java ] : https://github.com/dain/snappy
241
+ [ raw format ] : https://github.com/kubo/snzip#raw-format
242
+ [ Hadoop-snappy format ] : https://github.com/kubo/snzip#hadoop-snappy-format
0 commit comments