Search in sources :

Example 1 with SimpleFile

use of com.github.mgramin.sqlboot.tools.files.file.impl.SimpleFile in project sql-boot by sql-boot.

the class LocalFileSystem method listFiles.

@Override
public List<File> listFiles(final String mask) {
    try {
        DirectoryScanner scanner = new DirectoryScanner();
        scanner.setIncludes(new String[] { mask });
        scanner.setBasedir(this.basedir.replace("\\", "/"));
        scanner.setCaseSensitive(false);
        scanner.scan();
        String[] files = scanner.getIncludedFiles();
        List<File> result = new ArrayList<>();
        for (String file : files) {
            result.add(new SimpleFile(file, FileUtils.readFileToByteArray(new java.io.File(basedir + "/" + file))));
        }
        return result;
    } catch (IOException exception) {
        throw new BootException(exception);
    }
}
Also used : DirectoryScanner(org.apache.tools.ant.DirectoryScanner) ArrayList(java.util.ArrayList) SimpleFile(com.github.mgramin.sqlboot.tools.files.file.impl.SimpleFile) IOException(java.io.IOException) BootException(com.github.mgramin.sqlboot.exceptions.BootException) File(com.github.mgramin.sqlboot.tools.files.file.File) SimpleFile(com.github.mgramin.sqlboot.tools.files.file.impl.SimpleFile)

Aggregations

BootException (com.github.mgramin.sqlboot.exceptions.BootException)1 File (com.github.mgramin.sqlboot.tools.files.file.File)1 SimpleFile (com.github.mgramin.sqlboot.tools.files.file.impl.SimpleFile)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 DirectoryScanner (org.apache.tools.ant.DirectoryScanner)1