All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.kunalk16.excel.file.validation.ExcelFileFileValidator Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
package com.github.kunalk16.excel.file.validation;

import com.github.kunalk16.excel.utils.logger.ExcelReaderLogger;

import java.io.File;

public class ExcelFileFileValidator extends AbstractExcelFileValidator {
    ExcelFileFileValidator(ExcelFileValidator nextExcelFileValidator) {
        super(nextExcelFileValidator);
    }

    @Override
    protected boolean validateFile(String filePath) {
        File file = new File(filePath);

        if (!file.exists()) {
            ExcelReaderLogger.getInstance().severe("File does not exist!");
            return false;
        }

        if (!file.isFile()) {
            ExcelReaderLogger.getInstance().severe("Not a file!");
            return false;
        }

        if (!file.canRead()) {
            ExcelReaderLogger.getInstance().severe("Cannot read file!");
            return false;
        }

        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy