File src/de/jandankert/prefs/win32/RegistryImport.java

Last commit: Fri Jan 6 00:04:37 2012 +0100	Jan Dankert	let's start...
1 package de.jandankert.prefs.win32; 2 3 import java.io.File; 4 import java.io.FileOutputStream; 5 import java.io.IOException; 6 import java.util.List; 7 import java.util.Properties; 8 9 import de.jandankert.prefs.PrefSink; 10 import de.jandankert.prefs.Utils; 11 12 /** 13 * @author Jan Dankert 14 */ 15 public class RegistryImport implements PrefSink 16 { 17 18 private static FileOutputStream regedit; 19 20 public RegistryImport() 21 { 22 } 23 24 public void open() throws IOException 25 { 26 new File("Windows").mkdirs(); 27 regedit = new FileOutputStream(new File("Windows/prefs.reg")); 28 regedit.write("REGEDIT4\n\n".getBytes()); 29 } 30 31 public void close() throws IOException 32 { 33 regedit.close(); 34 } 35 36 public void sinkProperties(Properties props, List<String> path) throws IOException 37 { 38 new File("Unix/" + Utils.join(path, "/")).mkdirs(); 39 40 regedit.write(("[HKEY_CURRENT_USER\\Software\\JavaSoft\\prefs\\" + Utils.join(path, "\\") + "]\n").getBytes()); 41 for (Object key : props.keySet()) 42 { 43 44 Object value = props.get(key); 45 regedit.write(("\"" + key + "\"=\"" + value + "\"\n").getBytes()); 46 47 } 48 regedit.write("\n".getBytes()); 49 50 } 51 }
Download src/de/jandankert/prefs/win32/RegistryImport.java
History Fri, 6 Jan 2012 00:04:37 +0100 Jan Dankert let's start...