| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library barback.transformer.aggregate_transform; | 5 library barback.transformer.aggregate_transform; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:async/async.dart'; | 10 import 'package:async/async.dart'; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 /// | 74 /// |
| 75 /// This is equivalent to calling [getInput] followed by [Asset.readAsString]. | 75 /// This is equivalent to calling [getInput] followed by [Asset.readAsString]. |
| 76 /// | 76 /// |
| 77 /// If the asset was created from a [String] the original string is always | 77 /// If the asset was created from a [String] the original string is always |
| 78 /// returned and [encoding] is ignored. Otherwise, the binary data of the | 78 /// returned and [encoding] is ignored. Otherwise, the binary data of the |
| 79 /// asset is decoded using [encoding], which defaults to [UTF8]. | 79 /// asset is decoded using [encoding], which defaults to [UTF8]. |
| 80 /// | 80 /// |
| 81 /// If an input with [id] cannot be found, throws an [AssetNotFoundException]. | 81 /// If an input with [id] cannot be found, throws an [AssetNotFoundException]. |
| 82 Future<String> readInputAsString(AssetId id, {Encoding encoding}) { | 82 Future<String> readInputAsString(AssetId id, {Encoding encoding}) { |
| 83 if (encoding == null) encoding = UTF8; | 83 if (encoding == null) encoding = UTF8; |
| 84 return getInput(id).then/*<Future<String>>*/( | 84 return getInput(id).then<Future<String>>( |
| 85 (input) => input.readAsString(encoding: encoding)); | 85 (input) => input.readAsString(encoding: encoding)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 /// A convenience method to the contents of the input with [id]. | 88 /// A convenience method to the contents of the input with [id]. |
| 89 /// | 89 /// |
| 90 /// This is equivalent to calling [getInput] followed by [Asset.read]. | 90 /// This is equivalent to calling [getInput] followed by [Asset.read]. |
| 91 /// | 91 /// |
| 92 /// If the asset was created from a [String], this returns its UTF-8 encoding. | 92 /// If the asset was created from a [String], this returns its UTF-8 encoding. |
| 93 /// | 93 /// |
| 94 /// If an input with [id] cannot be found, throws an [AssetNotFoundException]. | 94 /// If an input with [id] cannot be found, throws an [AssetNotFoundException]. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 transform._inputController.add(input); | 145 transform._inputController.add(input); |
| 146 } | 146 } |
| 147 | 147 |
| 148 /// Returns whether an input with the given [id] was added via [addInput]. | 148 /// Returns whether an input with the given [id] was added via [addInput]. |
| 149 bool addedId(AssetId id) => transform._emittedPrimaryInputs.containsId(id); | 149 bool addedId(AssetId id) => transform._emittedPrimaryInputs.containsId(id); |
| 150 | 150 |
| 151 void done() { | 151 void done() { |
| 152 transform._inputController.close(); | 152 transform._inputController.close(); |
| 153 } | 153 } |
| 154 } | 154 } |
| OLD | NEW |