Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 101 lines (87 sloc) 1.926 kb
0a63dba Don't use bytes.NewBuffer(nil), shorten short tests, add package docstri...
Rémy Oudompheng authored
1 // Package go-liblzma is a wrapper for liblzma and XZ file format.
879fc48 Initial implementation.
Rémy Oudompheng authored
2 package xz
3
7e4a912 Remove bufsize argument to NewReader().
Rémy Oudompheng authored
4 const DefaultBufsize = 32768
5
879fc48 Initial implementation.
Rémy Oudompheng authored
6 type Action uint
7
8 const (
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
9 // Continue coding.
879fc48 Initial implementation.
Rémy Oudompheng authored
10 Run Action = iota
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
11 // Make all the input available at output.
879fc48 Initial implementation.
Rémy Oudompheng authored
12 SyncFlush
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
13 // Finish encoding of the current Block.
879fc48 Initial implementation.
Rémy Oudompheng authored
14 FullFlush
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
15 // Finish the coding operation.
879fc48 Initial implementation.
Rémy Oudompheng authored
16 Finish
17 )
18
19 type Errno uint
20
1719b01 Convert for error type.
Rémy Oudompheng authored
21 var _ error = Errno(0)
879fc48 Initial implementation.
Rémy Oudompheng authored
22
23 const (
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
24 // Operation completed successfully.
879fc48 Initial implementation.
Rémy Oudompheng authored
25 Ok Errno = iota
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
26 // End of stream was reached.
879fc48 Initial implementation.
Rémy Oudompheng authored
27 StreamEnd
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
28 // Input stream has no integrity check.
879fc48 Initial implementation.
Rémy Oudompheng authored
29 NoCheck
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
30 // Cannot calculate the integrity check.
879fc48 Initial implementation.
Rémy Oudompheng authored
31 UnsupportedCheck
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
32 // Integrity check type is now available.
879fc48 Initial implementation.
Rémy Oudompheng authored
33 GetCheck
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
34 // Cannot allocate memory.
879fc48 Initial implementation.
Rémy Oudompheng authored
35 MemError
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
36 // Memory usage limit was reached.
879fc48 Initial implementation.
Rémy Oudompheng authored
37 MemlimitError
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
38 // File format not recognized.
879fc48 Initial implementation.
Rémy Oudompheng authored
39 FormatError
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
40 // Invalid or unsupported options.
879fc48 Initial implementation.
Rémy Oudompheng authored
41 OptionsError
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
42 // Data is corrupt.
879fc48 Initial implementation.
Rémy Oudompheng authored
43 DataError
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
44 // No progress is possible.
879fc48 Initial implementation.
Rémy Oudompheng authored
45 BufError
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
46 // Programming error.
879fc48 Initial implementation.
Rémy Oudompheng authored
47 ProgError
48 )
49
50 var errorMsg = [...]string{
51 "Operation completed successfully",
52 "End of stream was reached",
53 "Input stream has no integrity check",
54 "Cannot calculate the integrity check",
55 "Integrity check type is now available",
56 "Cannot allocate memory",
57 "Memory usage limit was reached",
58 "File format not recognized",
59 "Invalid or unsupported options",
60 "Data is corrupt",
61 "No progress is possible",
62 "Programming error",
63 }
64
1719b01 Convert for error type.
Rémy Oudompheng authored
65 func (e Errno) Error() string {
879fc48 Initial implementation.
Rémy Oudompheng authored
66 return errorMsg[e]
67 }
361aac7 Add more constants and documentation.
Rémy Oudompheng authored
68
69 type Checksum uint
70
71 const (
72 CheckNone Checksum = 0
73 CheckCRC32 Checksum = 1
74 CheckCRC64 Checksum = 4
75 CheckSHA256 Checksum = 10
76 )
77
78 type Preset uint32
79
80 const (
81 Level0 Preset = iota
82 Level1
83 Level2
84 Level3
85 Level4
86 Level5
87 Level6
88 Level7
89 Level8
90 Level9
91 )
92
93 const (
94 // Default compression preset.
95 LevelDefault Preset = Level6
96 // Extreme compression preset. To be OR'ed with another preset.
97 LevelExtreme Preset = 1 << 31
98 // Mask for preset level. To AND with a Preset to extract the level.
99 LevelMask Preset = 0x1f
100 )
Something went wrong with that request. Please try again.