OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import "dart:async" show Future, Stream; | 5 import "dart:async" show Future, Stream; |
6 import "dart:convert" show Encoding; | 6 import "dart:convert" show Encoding; |
7 import "package_loader.dart"; | 7 import "package_loader.dart"; |
8 import "io_none.dart" | 8 import "io_none.dart" |
| 9 if (dart.library.html) "io_html.dart" |
9 if (dart.library.io) "io_io.dart" | 10 if (dart.library.io) "io_io.dart" |
10 if (dart.library.html) "io_html.dart" | |
11 as io; | 11 as io; |
12 | 12 |
13 /// Resource loading strategy. | 13 /// Resource loading strategy. |
14 /// | 14 /// |
15 /// An abstraction of the functionality needed to load resources. | 15 /// An abstraction of the functionality needed to load resources. |
16 /// | 16 /// |
17 /// Implementations of this interface decide which URI schemes they support. | 17 /// Implementations of this interface decide which URI schemes they support. |
18 abstract class ResourceLoader { | 18 abstract class ResourceLoader { |
19 /// A resource loader that can load as many of the following URI | 19 /// A resource loader that can load as many of the following URI |
20 /// schemes as are supported by the platform: | 20 /// schemes as are supported by the platform: |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const DefaultLoader(); | 62 const DefaultLoader(); |
63 | 63 |
64 Stream<List<int>> openRead(Uri uri) => io.readAsStream(uri); | 64 Stream<List<int>> openRead(Uri uri) => io.readAsStream(uri); |
65 | 65 |
66 Future<List<int>> readAsBytes(Uri uri) => io.readAsBytes(uri); | 66 Future<List<int>> readAsBytes(Uri uri) => io.readAsBytes(uri); |
67 | 67 |
68 Future<String> readAsString(Uri uri, {Encoding encoding}) => | 68 Future<String> readAsString(Uri uri, {Encoding encoding}) => |
69 io.readAsString(uri, encoding); | 69 io.readAsString(uri, encoding); |
70 } | 70 } |
71 | 71 |
OLD | NEW |