Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: sdk/lib/io/data_transformer.dart

Issue 2035473003: Avoid runtime type errors in checked mode for ChunkedConverters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/convert/utf.dart ('k') | sdk/lib/io/string_transformer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/convert/utf.dart ('k') | sdk/lib/io/string_transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698