mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 00:47:28 +01:00
Add a rac.CodecReader abstraction
This commit is contained in:
1 parent
635c3c8fe9
commit
cdf49196b1
4 files changed
+71
-128
No files matched your search
@@ -20,12 +20,14 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
|
||||
"github.com/google/wuffs/lib/rac"
|
||||
"github.com/google/wuffs/lib/raczlib"
|
||||
)
|
||||
|
||||
// Example_roundTrip demonstrates compressing (using a raczlib.Writer) and
|
||||
// decompressing (using a raczlib.Reader). This includes decompressing an
|
||||
// excerpt of the original data, exercising the "random access" part of RAC.
|
||||
// decompressing (using a rac.Reader configured with a raczlib.CodecReader).
|
||||
// This includes decompressing an excerpt of the original data, exercising the
|
||||
// "random access" part of RAC.
|
||||
func Example_roundTrip() {
|
||||
// Create some test data.
|
||||
oBuf := &bytes.Buffer{}
|
||||
@@ -67,9 +69,10 @@ func Example_roundTrip() {
|
||||
}
|
||||
|
||||
// Prepare to decompress.
|
||||
r := &raczlib.Reader{
|
||||
r := &rac.Reader{
|
||||
ReadSeeker: bytes.NewReader(compressed),
|
||||
CompressedSize: int64(len(compressed)),
|
||||
CodecReaders: []rac.CodecReader{&raczlib.CodecReader{}},
|
||||
}
|
||||
|
||||
// Read the whole file.
|
||||
|
||||
Reference in new issue
Block a user