/******************** * 2004 Jalview Reengineered * Barton Group * Dundee University * * AM Waterhouse *******************/ package jalview.bin; import java.util.*; import java.io.*; public class Cache { public static Properties applicationProperties; // Current properties include: // // LAST_DIRECTORY , use this to cache record of where the user looked to find a file // UNIPROT_CACHE // USER_DEFINED_COLOUR - file describing last user set colours // FONT_NAME // FONT_STYLE // FONT_SIZE public static void loadProperties() { applicationProperties = new Properties(); try { FileInputStream in = new FileInputStream(System.getProperty("user.home") + "/.jalview_properties"); applicationProperties = new Properties(); applicationProperties.load(in); in.close(); } catch (Exception ex) { } } public static String getProperty(String key) { return applicationProperties.getProperty(key); } public static String setProperty(String key, String obj) { try { FileOutputStream out = new FileOutputStream(System.getProperty( "user.home") + "/.jalview_properties"); applicationProperties.setProperty(key, obj); applicationProperties.store(out, "---JalviewX Properties File---"); out.close(); } catch (Exception ex) {} return obj; } }