use of com.mucommander.io.backup.BackupInputStream in project mucommander by mucommander.
the class CommandManager method loadAssociations.
/**
* Loads the custom associations XML File.
* <p>
* The command files will be loaded as a <i>backed-up file</i> (see {@link BackupInputStream}).
* Its format is described {@link AssociationsXmlConstants here}.
* </p>
* @throws IOException if an IO error occurs.
* @see #writeAssociations()
* @see #getAssociationFile()
* @see #setAssociationFile(String)
*/
public static void loadAssociations() throws IOException, CommandException {
AbstractFile file = getAssociationFile();
LOGGER.debug("Loading associations from file: " + file.getAbsolutePath());
// Tries to load the associations file.
// Associations are not considered to be modified by this.
InputStream in = null;
try {
AssociationReader.read(in = new BackupInputStream(file), new AssociationFactory());
} finally {
wereAssociationsModified = false;
// Makes sure the input stream is closed.
if (in != null) {
try {
in.close();
} catch (Exception e) {
// Ignores this.
}
}
}
}
use of com.mucommander.io.backup.BackupInputStream in project mucommander by mucommander.
the class BookmarkManager method loadBookmarks.
// - Bookmarks loading -----------------------------------------------------
// -------------------------------------------------------------------------
/**
* Loads all available bookmarks.
* @throws Exception if an error occurs.
*/
public static synchronized void loadBookmarks() throws Exception {
InputStream in;
// Parse the bookmarks file
in = null;
isLoading = true;
try {
readBookmarks(in = new BackupInputStream(getBookmarksFile()), new Loader());
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e) {
}
}
isLoading = false;
}
}
use of com.mucommander.io.backup.BackupInputStream in project mucommander by mucommander.
the class ShellHistoryManager method loadHistory.
/**
* Loads the shell history.
* @throws Exception if an error occurs.
*/
public static void loadHistory() throws Exception {
BackupInputStream in;
in = null;
try {
ShellHistoryReader.read(in = new BackupInputStream(getHistoryFile()));
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e2) {
}
}
}
}
use of com.mucommander.io.backup.BackupInputStream in project mucommander by mucommander.
the class CredentialsParser method parse.
/**
* Parses the given XML credentials file. Should only be called by CredentialsManager.
*/
void parse(AbstractFile file) throws Exception {
InputStream in;
in = null;
characters = new StringBuilder();
try {
SAXParserFactory.newInstance().newSAXParser().parse(in = new BackupInputStream(file), this);
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e) {
}
}
}
}
use of com.mucommander.io.backup.BackupInputStream in project mucommander by mucommander.
the class CommandManager method loadCommands.
/**
* Loads the custom commands XML File.
* <p>
* The command files will be loaded as a <i>backed-up file</i> (see {@link BackupInputStream}).
* Its format is described {@link CommandsXmlConstants here}.
* </p>
* @throws IOException if an I/O error occurs.
* @see #writeCommands()
* @see #getCommandsFile()
* @see #setCommandFile(String)
*/
public static void loadCommands() throws IOException, CommandException {
AbstractFile commandsFile = getCommandsFile();
LOGGER.debug("Loading custom commands from: " + commandsFile.getAbsolutePath());
// Commands are not considered to be modified by this.
try (InputStream in = new BackupInputStream(commandsFile)) {
CommandReader.read(in, new CommandManager());
}
}
Aggregations