将用户指定的数据保存成一个iso文件
源代码在线查看: applicationsettings.java
/* * ApplicationSettings.java * * Created on February 19, 2003, 8:20 AM */ package jcdwriter.model; import java.io.*; /** * * @author Ram Mallapp */ public class ApplicationSettings implements java.io.Serializable { public String isoDiskImageDirectory = "./"; public String diskLayoutFileDirectory = "./"; public static String configDirectory = "jcdwriter"; /* Directory where all config is stored */ public static String cdrecordConfigFileName = "cdrecord.conf"; public static String mkisofsConfigFileName = "mkisofs.conf"; public static String appSettingsConfigFileName = "jcdwriter.conf"; // debugLevel: 0-No logging 1-Everything (will change in future) public static int debugLevel = 0; /** Creates a new instance of ApplicationSettings */ public ApplicationSettings() { } public void isoDiskImageDirectory(String dir) { isoDiskImageDirectory = dir; } public String isoDiskImageDirectory() { return isoDiskImageDirectory; } public void diskLayoutFileDirectory(String dir) { diskLayoutFileDirectory = dir; } public String diskLayoutFileDirectory() { return diskLayoutFileDirectory; } public String getConfigDirectory() { return (getUserHomeDirectory() + "/." + configDirectory); } public String getUserHomeDirectory() { return (System.getProperty("user.home")); } public void saveToFile(File file) { try { FileWriter writer = new FileWriter(file); writer.write(""); writer.write("\r\n"); writer.write("#Application specific settings\r\n"); writer.write("iso_image_directory="); writer.write(isoDiskImageDirectory); writer.write("\r\n\r\n"); writer.write("disk_layout_file_directory="); writer.write(diskLayoutFileDirectory); writer.write("\r\n\r\n"); writer.write(""); writer.close(); } catch(java.io.FileNotFoundException fnfe) { System.out.println(fnfe); } catch(java.io.IOException ie) { System.out.println(ie); } } public void readFromFile(File file) { try { FileReader reader = new FileReader(file); BufferedReader br = new BufferedReader(reader); String line = null; while ((line = br.readLine()) != null) { //System.out.println("Read: " + line); if (line.indexOf("") >= 0) { //beginning of project definition } else { if (line.indexOf("iso_image_directory") >= 0) { this.isoDiskImageDirectory(line.substring(line.indexOf("=") + 1)); } else { if (line.indexOf("disk_layout_file_directory=") >= 0) { this.diskLayoutFileDirectory(line.substring(line.indexOf("=") + 1)); } else { } } } } br.close(); reader.close(); } catch(java.io.FileNotFoundException fnfe) { System.out.println(fnfe); } catch(java.io.IOException ie) { System.out.println(ie); } } }