⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.js

📁 JSVM核心类库,收集了JAVA进行JSVM开发必用技术进行归纳,在实际项目应用中直接引用相关类库即可现实JSVM相关功能!
💻 JS
字号:
// Description:	js.io.File 类
// Author:	Changhua.Wan
// Version:	2004.03.06.01

_package("js.io");
_import("js.lang.Object");

function js.io.File(_path) {
	this.path = null;
	this.data = null;
	if (typeof(_path) == "string") this.path = _path;

	this.getFileName = function() {
		if (this.path == null) return null;
		var idx = this.path.lastIndexOf("\\");
		return this.path.substring(idx + 1);
	};
	
	this.getData = function() {
		if (this.path == null) return null;
		if (this.data == null) {
			try {
				this.data = Class.forName("js.io.FileReader").readBinary(this.path);
			} catch(ex) {
				ex.printStackTrace();	
			}
		}
		return this.data;
	};
	this.saveAs = function(_path) {
		try {
			Class.forName("js.io.FileWriter").writeBinary(_path, this.getData());
			this.path = _path;
		} catch(ex) {
			ex.printStackTrace();	
		}
	};
	this.size = function() {
		if (typeof(vbs_lenb) == "undefined")
			execScript("Function vbs_lenb(d) \n vbs_lenb = LenB(d) \n End Function","VBScript");
		return vbs_lenb(this.getData());
	}
}

js.io.File._extends("js.lang.Object");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -