| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 bool _empty = true; | 476 bool _empty = true; |
| 477 | 477 |
| 478 _FilterSink(this._sink, this._filter); | 478 _FilterSink(this._sink, this._filter); |
| 479 | 479 |
| 480 void add(List<int> data) { | 480 void add(List<int> data) { |
| 481 addSlice(data, 0, data.length, false); | 481 addSlice(data, 0, data.length, false); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void addSlice(List<int> data, int start, int end, bool isLast) { | 484 void addSlice(List<int> data, int start, int end, bool isLast) { |
| 485 if (_closed) return; | 485 if (_closed) return; |
| 486 if (end == null) throw ArgumentError.notNull("end"); | 486 if (end == null) throw new ArgumentError.notNull("end"); |
| 487 RangeError.checkValidRange(start, end, data.length); | 487 RangeError.checkValidRange(start, end, data.length); |
| 488 try { | 488 try { |
| 489 _empty = false; | 489 _empty = false; |
| 490 _BufferAndStart bufferAndStart = | 490 _BufferAndStart bufferAndStart = |
| 491 _ensureFastAndSerializableByteData(data, start, end); | 491 _ensureFastAndSerializableByteData(data, start, end); |
| 492 _filter.process(bufferAndStart.buffer, | 492 _filter.process(bufferAndStart.buffer, |
| 493 bufferAndStart.start, | 493 bufferAndStart.start, |
| 494 end - (start - bufferAndStart.start)); | 494 end - (start - bufferAndStart.start)); |
| 495 var out; | 495 var out; |
| 496 while ((out = _filter.processed(flush: false)) != null) { | 496 while ((out = _filter.processed(flush: false)) != null) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 } | 586 } |
| 587 | 587 |
| 588 void _validateZLibStrategy(int strategy) { | 588 void _validateZLibStrategy(int strategy) { |
| 589 const strategies = const <int>[ZLibOption.STRATEGY_FILTERED, | 589 const strategies = const <int>[ZLibOption.STRATEGY_FILTERED, |
| 590 ZLibOption.STRATEGY_HUFFMAN_ONLY, ZLibOption.STRATEGY_RLE, | 590 ZLibOption.STRATEGY_HUFFMAN_ONLY, ZLibOption.STRATEGY_RLE, |
| 591 ZLibOption.STRATEGY_FIXED, ZLibOption.STRATEGY_DEFAULT]; | 591 ZLibOption.STRATEGY_FIXED, ZLibOption.STRATEGY_DEFAULT]; |
| 592 if (strategies.indexOf(strategy) == -1) { | 592 if (strategies.indexOf(strategy) == -1) { |
| 593 throw new ArgumentError("Unsupported 'strategy'"); | 593 throw new ArgumentError("Unsupported 'strategy'"); |
| 594 } | 594 } |
| 595 } | 595 } |
| OLD | NEW |