// Save the user configuration private void saveConfig() { if (sfa2 != null && sConfigFileName != null) { try { // Remove the file if it exists if (sfa2.exists(sConfigFileName)) { sfa2.kill(sConfigFileName); } // Then write the new contents XOutputStream xOs = sfa2.openFileWrite(sConfigFileName); if (xOs != null) { OutputStream os = new XOutputStreamToOutputStreamAdapter(xOs); config.write(os); os.close(); xOs.closeOutput(); } } catch (IOException e) { // ignore } catch (NotConnectedException e) { // ignore } catch (CommandAbortedException e) { // ignore } catch (com.sun.star.uno.Exception e) { // ignore } } }
// Load the user configuration from file private void loadConfig() { if (sfa2 != null && sConfigFileName != null) { try { XInputStream xIs = sfa2.openFileRead(sConfigFileName); if (xIs != null) { InputStream is = new XInputStreamToInputStreamAdapter(xIs); config.read(is); is.close(); xIs.closeInput(); } } catch (IOException e) { // ignore } catch (NotConnectedException e) { // ignore } catch (CommandAbortedException e) { // ignore } catch (com.sun.star.uno.Exception e) { // ignore } } }