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 library descriptor.entry; | 5 library descriptor.entry; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import '../utils.dart'; | 9 import '../utils.dart'; |
10 import 'utils.dart'; | 10 import 'utils.dart'; |
(...skipping 21 matching lines...) Expand all Loading... |
32 /// described by [this]. Returns a [Future] that completes to `null` if the | 32 /// described by [this]. Returns a [Future] that completes to `null` if the |
33 /// entry is valid, or throws an error if it failed. | 33 /// entry is valid, or throws an error if it failed. |
34 /// | 34 /// |
35 /// [parent] defaults to [defaultRoot]. | 35 /// [parent] defaults to [defaultRoot]. |
36 Future validate([String parent]); | 36 Future validate([String parent]); |
37 | 37 |
38 /// Treats [this] as an in-memory filesystem and returns a stream of the | 38 /// Treats [this] as an in-memory filesystem and returns a stream of the |
39 /// contents of the child entry located at [path]. This only works if [this] | 39 /// contents of the child entry located at [path]. This only works if [this] |
40 /// is a directory entry. This operation is not [schedule]d. | 40 /// is a directory entry. This operation is not [schedule]d. |
41 /// | 41 /// |
| 42 /// This method uses POSIX paths regardless of the underlying operating |
| 43 /// system. |
| 44 /// |
42 /// All errors in loading the file will be passed through the returned | 45 /// All errors in loading the file will be passed through the returned |
43 /// [Stream]. | 46 /// [Stream]. |
44 Stream<List<int>> load(String pathToLoad) => errorStream("Can't load " | 47 Stream<List<int>> load(String pathToLoad) => errorStream("Can't load " |
45 "'$pathToLoad' from within $nameDescription: not a directory."); | 48 "'$pathToLoad' from within $nameDescription: not a directory."); |
46 | 49 |
47 /// Returns the contents of [this] as a stream. This only works if [this] is a | 50 /// Returns the contents of [this] as a stream. This only works if [this] is a |
48 /// file entry. This operation is not [schedule]d. | 51 /// file entry. This operation is not [schedule]d. |
49 /// | 52 /// |
50 /// All errors in loading the file will be passed through the returned | 53 /// All errors in loading the file will be passed through the returned |
51 /// [Stream]. | 54 /// [Stream]. |
52 Stream<List<int>> read(); | 55 Stream<List<int>> read(); |
53 | 56 |
54 /// Asserts that the name of the descriptor is a [String] and returns it. | 57 /// Asserts that the name of the descriptor is a [String] and returns it. |
55 String get stringName { | 58 String get stringName { |
56 if (name is String) return name; | 59 if (name is String) return name; |
57 throw 'Pattern $nameDescription must be a string.'; | 60 throw 'Pattern $nameDescription must be a string.'; |
58 } | 61 } |
59 | 62 |
60 /// Returns a human-readable description of [name], for error reporting. For | 63 /// Returns a human-readable description of [name], for error reporting. For |
61 /// string names, this will just be the name in quotes; for regular | 64 /// string names, this will just be the name in quotes; for regular |
62 /// expressions, it will use JavaScript-style `/.../` notation. | 65 /// expressions, it will use JavaScript-style `/.../` notation. |
63 String get nameDescription => describePattern(name); | 66 String get nameDescription => describePattern(name); |
64 | 67 |
65 /// Returns a detailed tree-style description of [this]. | 68 /// Returns a detailed tree-style description of [this]. |
66 String describe(); | 69 String describe(); |
67 } | 70 } |
OLD | NEW |