当前位置: 首页>>代码示例>>Java>>正文


Java FileAccess.isStreamElement方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:27,代码来源:DataFileCache.java

示例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);
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:18,代码来源:DataFileCache.java

示例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);
            }
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:23,代码来源:DataFileCache.java

示例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);
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:26,代码来源:DataFileCache.java

示例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);
            }
        }
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:23,代码来源:DataFileCache.java

示例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
        });
    }
}
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:27,代码来源:DataFileCache.java

示例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
        });
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:30,代码来源:DataFileCache.java

示例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);
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:41,代码来源:DataFileCache.java

示例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);
        }
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:12,代码来源:DataFileCache.java

示例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
        });
    }
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:28,代码来源:DataFileCache.java


注:本文中的org.hsqldb.lib.FileAccess.isStreamElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。