| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.source.io; | 8 library engine.source.io; |
| 9 | 9 |
| 10 import 'engine.dart'; | 10 import 'engine.dart'; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return path; | 80 return path; |
| 81 } | 81 } |
| 82 return "$path${JavaFile.separator}"; | 82 return "$path${JavaFile.separator}"; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * Instances of the class `FileBasedSource` implement a source that represents a
file. | 87 * Instances of the class `FileBasedSource` implement a source that represents a
file. |
| 88 */ | 88 */ |
| 89 class FileBasedSource implements Source { | 89 class FileBasedSource implements Source { |
| 90 |
| 91 /** |
| 92 * A function that changes the way that files are read off of disk. |
| 93 */ |
| 94 static Function fileReadMode = (String s) => s; |
| 95 |
| 90 /** | 96 /** |
| 91 * The URI from which this source was originally derived. | 97 * The URI from which this source was originally derived. |
| 92 */ | 98 */ |
| 93 final Uri uri; | 99 final Uri uri; |
| 94 | 100 |
| 95 /** | 101 /** |
| 96 * The file represented by this source. | 102 * The file represented by this source. |
| 97 */ | 103 */ |
| 98 final JavaFile file; | 104 final JavaFile file; |
| 99 | 105 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 * because contexts can have local overrides of the content of a source that t
he source is not | 145 * because contexts can have local overrides of the content of a source that t
he source is not |
| 140 * aware of. | 146 * aware of. |
| 141 * | 147 * |
| 142 * @return the contents of the source paired with the modification stamp of th
e source | 148 * @return the contents of the source paired with the modification stamp of th
e source |
| 143 * @throws Exception if the contents of this source could not be accessed | 149 * @throws Exception if the contents of this source could not be accessed |
| 144 * See [contents]. | 150 * See [contents]. |
| 145 */ | 151 */ |
| 146 TimestampedData<String> get contentsFromFile { | 152 TimestampedData<String> get contentsFromFile { |
| 147 return new TimestampedData<String>( | 153 return new TimestampedData<String>( |
| 148 file.lastModified(), | 154 file.lastModified(), |
| 149 file.readAsStringSync()); | 155 fileReadMode(file.readAsStringSync())); |
| 150 } | 156 } |
| 151 | 157 |
| 152 @override | 158 @override |
| 153 String get encoding { | 159 String get encoding { |
| 154 if (_encoding == null) { | 160 if (_encoding == null) { |
| 155 _encoding = uri.toString(); | 161 _encoding = uri.toString(); |
| 156 } | 162 } |
| 157 return _encoding; | 163 return _encoding; |
| 158 } | 164 } |
| 159 | 165 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 } | 539 } |
| 534 | 540 |
| 535 /** | 541 /** |
| 536 * Return `true` if the given URI is a `file` URI. | 542 * Return `true` if the given URI is a `file` URI. |
| 537 * | 543 * |
| 538 * @param uri the URI being tested | 544 * @param uri the URI being tested |
| 539 * @return `true` if the given URI is a `file` URI | 545 * @return `true` if the given URI is a `file` URI |
| 540 */ | 546 */ |
| 541 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; | 547 static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME; |
| 542 } | 548 } |
| OLD | NEW |