aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/ulikunitz/xz/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/ulikunitz/xz/README.md')
-rw-r--r--vendor/github.com/ulikunitz/xz/README.md72
1 files changed, 37 insertions, 35 deletions
diff --git a/vendor/github.com/ulikunitz/xz/README.md b/vendor/github.com/ulikunitz/xz/README.md
index 969ae7a..0a2dc82 100644
--- a/vendor/github.com/ulikunitz/xz/README.md
+++ b/vendor/github.com/ulikunitz/xz/README.md
@@ -12,46 +12,48 @@ have been developed over a long time and are highly optimized. However
12there are a number of improvements planned and I'm very optimistic about 12there are a number of improvements planned and I'm very optimistic about
13parallel compression and decompression. Stay tuned! 13parallel compression and decompression. Stay tuned!
14 14
15# Using the API 15## Using the API
16 16
17The following example program shows how to use the API. 17The following example program shows how to use the API.
18 18
19 package main 19```go
20 20package main
21 import ( 21
22 "bytes" 22import (
23 "io" 23 "bytes"
24 "log" 24 "io"
25 "os" 25 "log"
26 26 "os"
27 "github.com/ulikunitz/xz" 27
28 ) 28 "github.com/ulikunitz/xz"
29 29)
30 func main() { 30
31 const text = "The quick brown fox jumps over the lazy dog.\n" 31func main() {
32 var buf bytes.Buffer 32 const text = "The quick brown fox jumps over the lazy dog.\n"
33 // compress text 33 var buf bytes.Buffer
34 w, err := xz.NewWriter(&buf) 34 // compress text
35 if err != nil { 35 w, err := xz.NewWriter(&buf)
36 log.Fatalf("xz.NewWriter error %s", err) 36 if err != nil {
37 } 37 log.Fatalf("xz.NewWriter error %s", err)
38 if _, err := io.WriteString(w, text); err != nil {
39 log.Fatalf("WriteString error %s", err)
40 }
41 if err := w.Close(); err != nil {
42 log.Fatalf("w.Close error %s", err)
43 }
44 // decompress buffer and write output to stdout
45 r, err := xz.NewReader(&buf)
46 if err != nil {
47 log.Fatalf("NewReader error %s", err)
48 }
49 if _, err = io.Copy(os.Stdout, r); err != nil {
50 log.Fatalf("io.Copy error %s", err)
51 }
52 } 38 }
39 if _, err := io.WriteString(w, text); err != nil {
40 log.Fatalf("WriteString error %s", err)
41 }
42 if err := w.Close(); err != nil {
43 log.Fatalf("w.Close error %s", err)
44 }
45 // decompress buffer and write output to stdout
46 r, err := xz.NewReader(&buf)
47 if err != nil {
48 log.Fatalf("NewReader error %s", err)
49 }
50 if _, err = io.Copy(os.Stdout, r); err != nil {
51 log.Fatalf("io.Copy error %s", err)
52 }
53}
54```
53 55
54# Using the gxz compression tool 56## Using the gxz compression tool
55 57
56The package includes a gxz command line utility for compression and 58The package includes a gxz command line utility for compression and
57decompression. 59decompression.