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

Side by Side Diff: lib/src/resource_loader.dart

Issue 1612003002: Add browser-compatible version. (Closed) Base URL: https://github.com/dart-lang/resource.git@master
Patch Set: Made test run Created 4 years, 10 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 | « lib/src/resource.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "dart:async" show Future, Stream;
6 import "dart:convert" show Encoding;
7
8 /// Resource loading strategy.
9 ///
10 /// An abstraction of the functionality needed to load resources.
11 ///
12 /// Implementations of this interface decide which URI schemes they support.
13 abstract class ResourceLoader {
14 /// Reads the file located by [uri] as a stream of bytes.
15 Stream<List<int>> openRead(Uri uri);
16
17 /// Reads the file located by [uri] as a list of bytes.
18 Future<List<int>> readAsBytes(Uri uri);
19
20 /// Reads the file located by [uri] as a [String].
21 ///
22 /// The file bytes are decoded using [encoding], if provided.
23 ///
24 /// If [encoding] is omitted, the default for the `file:` scheme is UTF-8.
25 /// For `http`, `https` and `data` URIs, the Content-Type header's charset
26 /// is used, if available and recognized by [Encoding.getByName],
27 /// otherwise it defaults to Latin-1 for `http` and `https`
28 /// and to ASCII for `data` URIs.
29 Future<String> readAsString(Uri uri, {Encoding encoding});
30 }
31
OLDNEW
« no previous file with comments | « lib/src/resource.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698