欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

savetext.java

PIY(Program It Yourself)是一个基于Java的应用程序开发环境
JAVA
字号:
package piy.action;

import piy.PIYAction;
import piy.FixedProperty;
import java.io.*;

/**
* Saves text to a specified file.
*
* @author David Vivash
* @version 1.0, 02/05/01
*/
public class SaveText implements PIYAction, Serializable {
	private FixedProperty saveTo = new FixedProperty(null, File.class);
	private FixedProperty toSave = new FixedProperty("", String.class);

	public FixedProperty getTo() { return saveTo; }
	public void setTo(FixedProperty file) { saveTo = file; }

	public FixedProperty getSave() { return toSave; }
	public void setSave(FixedProperty text) { toSave = text; }

	public Class getReturnType() { return null; }
	
	public Object execute() {		
		try {
			FileOutputStream output = new FileOutputStream((File)saveTo.getActualValue());
			output.write(((String)toSave.getActualValue()).getBytes());
			output.close();	
		} catch (Exception e) {
			System.out.println("Couldn't load text file: " + saveTo);
		}

		return null;
	}

}

⌨️ 快捷键说明

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