OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * Exposes ZLib options for input parameters. | 8 * Exposes ZLib options for input parameters. |
9 * | 9 * |
10 * See http://www.zlib.net/manual.html for more documentation. | 10 * See http://www.zlib.net/manual.html for more documentation. |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 * Get a [ZLibDecoder] for decoding `GZip` compressed data. | 268 * Get a [ZLibDecoder] for decoding `GZip` compressed data. |
269 */ | 269 */ |
270 ZLibDecoder get decoder => | 270 ZLibDecoder get decoder => |
271 new ZLibDecoder(windowBits: windowBits, dictionary: dictionary, raw: raw); | 271 new ZLibDecoder(windowBits: windowBits, dictionary: dictionary, raw: raw); |
272 } | 272 } |
273 | 273 |
274 /** | 274 /** |
275 * The [ZLibEncoder] encoder is used by [ZLibCodec] and [GZipCodec] to compress | 275 * The [ZLibEncoder] encoder is used by [ZLibCodec] and [GZipCodec] to compress |
276 * data. | 276 * data. |
277 */ | 277 */ |
278 class ZLibEncoder extends Converter<List<int>, List<int>> { | 278 class ZLibEncoder extends Converter<List<int>, List<int>> |
| 279 implements ChunkedConverter<List<int>, List<int>, List<int>, List<int>> { |
| 280 |
279 /** | 281 /** |
280 * When true, `GZip` frames will be added to the compressed data. | 282 * When true, `GZip` frames will be added to the compressed data. |
281 */ | 283 */ |
282 final bool gzip; | 284 final bool gzip; |
283 | 285 |
284 /** | 286 /** |
285 * The compression-[level] can be set in the range of `-1..9`, with `6` being | 287 * The compression-[level] can be set in the range of `-1..9`, with `6` being |
286 * the default compression level. Levels above `6` will have higher | 288 * the default compression level. Levels above `6` will have higher |
287 * compression rates at the cost of more CPU and memory usage. Levels below | 289 * compression rates at the cost of more CPU and memory usage. Levels below |
288 * `6` will use less CPU and memory at the cost of lower compression rates. | 290 * `6` will use less CPU and memory at the cost of lower compression rates. |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 } | 580 } |
579 | 581 |
580 void _validateZLibStrategy(int strategy) { | 582 void _validateZLibStrategy(int strategy) { |
581 const strategies = const <int>[ZLibOption.STRATEGY_FILTERED, | 583 const strategies = const <int>[ZLibOption.STRATEGY_FILTERED, |
582 ZLibOption.STRATEGY_HUFFMAN_ONLY, ZLibOption.STRATEGY_RLE, | 584 ZLibOption.STRATEGY_HUFFMAN_ONLY, ZLibOption.STRATEGY_RLE, |
583 ZLibOption.STRATEGY_FIXED, ZLibOption.STRATEGY_DEFAULT]; | 585 ZLibOption.STRATEGY_FIXED, ZLibOption.STRATEGY_DEFAULT]; |
584 if (strategies.indexOf(strategy) == -1) { | 586 if (strategies.indexOf(strategy) == -1) { |
585 throw new ArgumentError("Unsupported 'strategy'"); | 587 throw new ArgumentError("Unsupported 'strategy'"); |
586 } | 588 } |
587 } | 589 } |
OLD | NEW |