| OLD | NEW |
| 1 library java.io; | 1 library java.io; |
| 2 | 2 |
| 3 import "dart:io"; | 3 import "dart:io"; |
| 4 import 'java_core.dart' show JavaIOException; | 4 import 'java_core.dart' show JavaIOException, CharSequence; |
| 5 import 'package:path/path.dart' as pathos; | 5 import 'package:path/path.dart' as pathos; |
| 6 | 6 |
| 7 class JavaSystemIO { | 7 class JavaSystemIO { |
| 8 static Map<String, String> _properties = new Map(); | 8 static Map<String, String> _properties = new Map(); |
| 9 static String getProperty(String name) { | 9 static String getProperty(String name) { |
| 10 { | 10 { |
| 11 String value = _properties[name]; | 11 String value = _properties[name]; |
| 12 if (value != null) { | 12 if (value != null) { |
| 13 return value; | 13 return value; |
| 14 } | 14 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath()); | 96 JavaFile getCanonicalFile() => new JavaFile(getCanonicalPath()); |
| 97 bool exists() { | 97 bool exists() { |
| 98 if (_newFile().existsSync()) { | 98 if (_newFile().existsSync()) { |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 if (_newDirectory().existsSync()) { | 101 if (_newDirectory().existsSync()) { |
| 102 return true; | 102 return true; |
| 103 } | 103 } |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 bool isFile() { |
| 107 return _newFile().existsSync(); |
| 108 } |
| 106 bool isDirectory() { | 109 bool isDirectory() { |
| 107 return _newDirectory().existsSync(); | 110 return _newDirectory().existsSync(); |
| 108 } | 111 } |
| 109 Uri toURI() => pathos.toUri(_path); | 112 Uri toURI() => pathos.toUri(_path); |
| 110 String readAsStringSync() => _newFile().readAsStringSync(); | 113 String readAsStringSync() => _newFile().readAsStringSync(); |
| 114 CharSequence readAsCharSequenceSync() => CharSequence.wrap(readAsStringSync())
; |
| 111 int lastModified() { | 115 int lastModified() { |
| 112 if (!_newFile().existsSync()) return 0; | 116 if (!_newFile().existsSync()) return 0; |
| 113 return _newFile().lastModifiedSync().millisecondsSinceEpoch; | 117 return _newFile().lastModifiedSync().millisecondsSinceEpoch; |
| 114 | 118 |
| 115 } | 119 } |
| 116 List<JavaFile> listFiles() { | 120 List<JavaFile> listFiles() { |
| 117 var files = <JavaFile>[]; | 121 var files = <JavaFile>[]; |
| 118 var entities = _newDirectory().listSync(); | 122 var entities = _newDirectory().listSync(); |
| 119 for (FileSystemEntity entity in entities) { | 123 for (FileSystemEntity entity in entities) { |
| 120 files.add(new JavaFile(entity.path)); | 124 files.add(new JavaFile(entity.path)); |
| 121 } | 125 } |
| 122 return files; | 126 return files; |
| 123 } | 127 } |
| 124 File _newFile() => new File(_path); | 128 File _newFile() => new File(_path); |
| 125 Directory _newDirectory() => new Directory(_path); | 129 Directory _newDirectory() => new Directory(_path); |
| 126 } | 130 } |
| OLD | NEW |