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

Unified Diff: pkg/polymer/lib/src/file_system.dart

Issue 23224003: move polymer.dart into dart svn (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/lib/src/file_system.dart
diff --git a/pkg/polymer/lib/src/file_system.dart b/pkg/polymer/lib/src/file_system.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c6af55ce8b0744deacd8d9556367d71036c86b97
--- /dev/null
+++ b/pkg/polymer/lib/src/file_system.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/** Abstraction for file systems and utility functions to manipulate paths. */
+library file_system;
+
+import 'dart:async';
+
+/**
+ * Abstraction around file system access to work in a variety of different
+ * environments.
+ */
+abstract class FileSystem {
+ /**
+ * Apply all pending writes. Until this method is called, writeString is not
+ * guaranteed to have any observable impact.
+ */
+ Future flush();
+
+ /**
+ * Reads bytes if possible, but falls back to text if running in a browser.
+ * Return type is either [Future<List<int>>] or [Future<String>].
+ */
+ Future readTextOrBytes(String path);
+
+ /* Like [readTextOrBytes], but decodes bytes as UTF-8. Used for Dart code. */
+ Future<String> readText(String path);
+
+ /**
+ * Writes [text] to file at [path]. Call flush to insure that changes are
+ * visible.
+ */
+ void writeString(String path, String text);
+}

Powered by Google App Engine
This is Rietveld 408576698