📄 filereader.js
字号:
// Description: js.io.FileReader 类
// Author: Changhua.Wan
// Version: 2004.03.06.01
_package("js.io");
_import("js.io.InputStream");
function js.io.FileReader() {
this.filepath = null;
if (typeof(arguments[0]) == "string")
this.filepath = arguments[0];
else if (typeof(arguments[0]) == "object" && typeof(arguments[0].path) == "string")
this.filepath = arguments[0].path;
else
this.filepath = null;
this.data = null;
// 二进制操作
this.read = function() {
return (this.data = js.io.FileReader.readBinary(this.filepath));
};
this.readAll = function() {
//TODO
};
// 文本操作
this.readLine = function() {
//TODO
};
this.readAll = function() {
//TODO
};
}
var _p = js.io.FileReader._implements("js.io.InputStream");
var _c = js.io.FileReader;
// 同源安全限制
_c.readBinary = function(_path) {
try {
var stream = new ActiveXObject("ADODB.Stream");
stream.Mode = 3 ;
stream.Type = 1 ;
stream.open();
stream.LoadFromFile(_path);
var binaryStream = stream.Read();
stream.close();
return binaryStream;
} catch(ex) {
ex.printStackTrace();
}
};
_c.readText = function(_path) {
try {
var fso = new ActiveXObject("Scripting.FileSystemObject");
// TODO
} catch(ex) {
ex.printStackTrace();
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -