| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012, 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 /** Abstraction for file systems and utility functions to manipulate paths. */ | |
| 6 library file_system; | |
| 7 | |
| 8 import 'dart:async'; | |
| 9 | |
| 10 /** | |
| 11 * Abstraction around file system access to work in a variety of different | |
| 12 * environments. | |
| 13 */ | |
| 14 abstract class FileSystem { | |
| 15 /** | |
| 16 * Apply all pending writes. Until this method is called, writeString is not | |
| 17 * guaranteed to have any observable impact. | |
| 18 */ | |
| 19 Future flush(); | |
| 20 | |
| 21 /** | |
| 22 * Reads bytes if possible, but falls back to text if running in a browser. | |
| 23 * Return type is either [Future<List<int>>] or [Future<String>]. | |
| 24 */ | |
| 25 Future readTextOrBytes(String path); | |
| 26 | |
| 27 /* Like [readTextOrBytes], but decodes bytes as UTF-8. Used for Dart code. */ | |
| 28 Future<String> readText(String path); | |
| 29 | |
| 30 /** | |
| 31 * Writes [text] to file at [path]. Call flush to insure that changes are | |
| 32 * visible. | |
| 33 */ | |
| 34 void writeString(String path, String text); | |
| 35 } | |
| OLD | NEW |