本文整理汇总了Java中org.hsqldb.lib.FileAccess.isStreamElement方法的典型用法代码示例。如果您正苦于以下问题:Java FileAccess.isStreamElement方法的具体用法?Java FileAccess.isStreamElement怎么用?Java FileAccess.isStreamElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hsqldb.lib.FileAccess
的用法示例。
在下文中一共展示了FileAccess.isStreamElement方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreBackupIncremental
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
/**
* Restores in from an incremental backup
*/
private boolean restoreBackupIncremental() {
try {
FileAccess fileAccess = database.logger.getFileAccess();
if (fileAccess.isStreamElement(backupFileName)) {
RAShadowFile.restoreFile(database, backupFileName,
dataFileName);
deleteFile(database, backupFileName);
return true;
}
// this is an anomaly where no backup exists but .data file
// modified flag has been set
return false;
} catch (Throwable e) {
database.logger.logSevereEvent(
"DataFileCache.restoreBackupIncremental", e);
throw Error.error(ErrorCode.FILE_IO_ERROR, e);
}
}
示例2: renameBackupFile
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
static void renameBackupFile(Database database, String backupFileName) {
FileAccess fileAccess = database.logger.getFileAccess();
if (database.logger.propIncrementBackup) {
deleteFile(database, backupFileName);
return;
}
if (fileAccess.isStreamElement(backupFileName
+ Logger.newFileExtension)) {
deleteFile(database, backupFileName);
fileAccess.renameElement(backupFileName + Logger.newFileExtension,
backupFileName);
}
}
示例3: deleteFile
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
static void deleteFile(Database database, String fileName) {
FileAccess fileAccess = database.logger.getFileAccess();
// first attempt to delete
fileAccess.removeElement(fileName);
if (database.logger.isStoredFileAccess()) {
return;
}
if (fileAccess.isStreamElement(fileName)) {
database.logger.log.deleteOldDataFiles();
fileAccess.removeElement(fileName);
if (fileAccess.isStreamElement(fileName)) {
String discardName = FileUtil.newDiscardFileName(fileName);
fileAccess.renameElement(fileName, discardName);
}
}
}
示例4: restoreBackupIncremental
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
/**
* Restores in from an incremental backup
*/
static boolean restoreBackupIncremental(Database database,
String dataFileName, String backupFileName) {
try {
FileAccess fileAccess = database.logger.getFileAccess();
if (fileAccess.isStreamElement(backupFileName)) {
RAShadowFile.restoreFile(database, backupFileName,
dataFileName);
deleteFile(database, backupFileName);
return true;
}
return false;
} catch (Throwable e) {
database.logger.logSevereEvent(
"DataFileCache.restoreBackupIncremental", e);
throw Error.error(ErrorCode.FILE_IO_ERROR, e);
}
}
示例5: deleteFile
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
static void deleteFile(Database database, String fileName) {
FileAccess fileAccess = database.logger.getFileAccess();
// first attemp to delete
fileAccess.removeElement(fileName);
if (database.logger.isStoredFileAccess()) {
return;
}
if (fileAccess.isStreamElement(fileName)) {
database.logger.log.deleteOldDataFiles();
fileAccess.removeElement(fileName);
if (fileAccess.isStreamElement(fileName)) {
String discardName = FileUtil.newDiscardFileName(fileName);
fileAccess.renameElement(fileName, discardName);
}
}
}
示例6: restoreBackup
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
/**
* Restores a compressed backup or the .data file.
*/
private boolean restoreBackup() {
// in case data file cannot be deleted, reset it
deleteFile();
try {
FileAccess fa = database.logger.getFileAccess();
if (fa.isStreamElement(backupFileName)) {
FileArchiver.unarchive(backupFileName, dataFileName, fa,
FileArchiver.COMPRESSION_ZIP);
return true;
}
return false;
} catch (Throwable t) {
throw Error.error(t, ErrorCode.FILE_IO_ERROR,
ErrorCode.M_Message_Pair, new Object[] {
t.toString(), backupFileName
});
}
}
示例7: restoreBackup
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
/**
* Restores a compressed backup or the .data file.
*/
private boolean restoreBackup() {
try {
FileAccess fileAccess = database.logger.getFileAccess();
// todo - in case data file cannot be deleted, reset it
deleteFile(database, dataFileName);
if (fileAccess.isStreamElement(backupFileName)) {
FileArchiver.unarchive(backupFileName, dataFileName,
fileAccess,
FileArchiver.COMPRESSION_ZIP);
return true;
}
return false;
} catch (Throwable t) {
database.logger.logSevereEvent("DataFileCache.restoreBackup", t);
throw Error.error(t, ErrorCode.FILE_IO_ERROR,
ErrorCode.M_Message_Pair, new Object[] {
t.toString(), backupFileName
});
}
}
示例8: backupFile
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
static void backupFile(Database database, String fileName,
String backupFileName, boolean newFile) {
try {
FileAccess fa = database.logger.getFileAccess();
if (database.logger.propIncrementBackup) {
if (fa.isStreamElement(backupFileName)) {
deleteFile(database, backupFileName);
if (fa.isStreamElement(backupFileName)) {
throw Error.error(ErrorCode.DATA_FILE_ERROR,
"cannot delete old backup file");
}
}
return;
}
if (fa.isStreamElement(fileName)) {
if (newFile) {
backupFileName += Logger.newFileExtension;
} else {
deleteFile(database, backupFileName);
if (fa.isStreamElement(backupFileName)) {
throw Error.error(ErrorCode.DATA_FILE_ERROR,
"cannot delete old backup file");
}
}
FileArchiver.archive(fileName, backupFileName, fa,
FileArchiver.COMPRESSION_ZIP);
}
} catch (Throwable t) {
database.logger.logSevereEvent("DataFileCache.backupFile", t);
throw Error.error(ErrorCode.DATA_FILE_ERROR, t);
}
}
示例9: renameDataFile
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
static void renameDataFile(Database database, String dataFileName) {
FileAccess fileAccess = database.logger.getFileAccess();
if (fileAccess.isStreamElement(dataFileName
+ Logger.newFileExtension)) {
deleteFile(database, dataFileName);
fileAccess.renameElement(dataFileName + Logger.newFileExtension,
dataFileName);
}
}
示例10: restoreBackup
import org.hsqldb.lib.FileAccess; //导入方法依赖的package包/类
static boolean restoreBackup(Database database, String dataFileName,
String backupFileName) {
try {
FileAccess fileAccess = database.logger.getFileAccess();
// todo - in case data file cannot be deleted, reset it
deleteFile(database, dataFileName);
if (fileAccess.isStreamElement(backupFileName)) {
FileArchiver.unarchive(backupFileName, dataFileName,
fileAccess,
FileArchiver.COMPRESSION_ZIP);
return true;
}
return false;
} catch (Throwable t) {
database.logger.logSevereEvent("DataFileCache.restoreBackup", t);
throw Error.error(t, ErrorCode.FILE_IO_ERROR,
ErrorCode.M_Message_Pair, new Object[] {
t.toString(), backupFileName
});
}
}