Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(55)

Delta Between Two Patch Sets: src/pkg/compress/flate/deflate.go

Issue 5639057: code review 5639057: compress/gzip: NewWriter no longer returns an error. (Closed)
Left Patch Set: diff -r b9ae3df7a5e7 https://go.googlecode.com/hg/ Created 13 years, 1 month ago
Right Patch Set: diff -r 838fa1514da3 https://go.googlecode.com/hg/ Created 13 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/archive/zip/writer.go ('k') | src/pkg/compress/flate/deflate_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package flate 5 package flate
6 6
7 import ( 7 import (
8 "io" 8 "io"
9 "math" 9 "math"
10 ) 10 )
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 } 425 }
426 return &dw, nil 426 return &dw, nil
427 } 427 }
428 428
429 // NewWriterDict is like NewWriter but initializes the new 429 // NewWriterDict is like NewWriter but initializes the new
430 // Writer with a preset dictionary. The returned Writer behaves 430 // Writer with a preset dictionary. The returned Writer behaves
431 // as if the dictionary had been written to it without producing 431 // as if the dictionary had been written to it without producing
432 // any compressed output. The compressed data written to w 432 // any compressed output. The compressed data written to w
433 // can only be decompressed by a Reader initialized with the 433 // can only be decompressed by a Reader initialized with the
434 // same dictionary. 434 // same dictionary.
435 //
436 // If level is in the range [-1, 9] then the error returned will be nil.
437 // Otherwise the error returned will be non-nil.
438 func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, error) { 435 func NewWriterDict(w io.Writer, level int, dict []byte) (*Writer, error) {
439 dw := &dictWriter{w, false} 436 dw := &dictWriter{w, false}
440 zw, err := NewWriter(dw, level) 437 zw, err := NewWriter(dw, level)
441 if err != nil { 438 if err != nil {
442 return nil, err 439 return nil, err
443 } 440 }
444 zw.Write(dict) 441 zw.Write(dict)
445 zw.Flush() 442 zw.Flush()
446 dw.enabled = true 443 dw.enabled = true
447 return zw, err 444 return zw, err
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 func (w *Writer) Flush() error { 478 func (w *Writer) Flush() error {
482 // For more about flushing: 479 // For more about flushing:
483 // http://www.bolet.org/~pornin/deflate-flush.html 480 // http://www.bolet.org/~pornin/deflate-flush.html
484 return w.d.syncFlush() 481 return w.d.syncFlush()
485 } 482 }
486 483
487 // Close flushes and closes the writer. 484 // Close flushes and closes the writer.
488 func (w *Writer) Close() error { 485 func (w *Writer) Close() error {
489 return w.d.close() 486 return w.d.close()
490 } 487 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b