Example usage for java.io File isHidden

List of usage examples for java.io File isHidden

Introduction

In this page you can find the example usage for java.io File isHidden.

Prototype

public boolean isHidden() 

Source Link

Document

Tests whether the file named by this abstract pathname is a hidden file.

Usage

From source file:org.cobol85.runner.impl.Cobol85ParseTestRunnerImpl.java

@Override
public void parseDirectory(final File inputDirectory, final Cobol85FormatEnum[] formats) throws IOException {
    if (inputDirectory.isDirectory() && !inputDirectory.isHidden()) {
        for (final File inputFile : inputDirectory.listFiles()) {
            if (inputFile.isFile() && !inputFile.isHidden() && isCobolFile(inputFile)) {
                parseFile(inputFile, formats);
            }//from w  ww .  j a  va 2  s . c o m
        }
    }
}

From source file:org.jasig.portal.utils.PatternSetFileFilter.java

@Override
public boolean accept(File pathname) {
    if (acceptDirectories && pathname.isDirectory()) {
        return true;
    }/*  ww  w. j av a2s.c  o m*/
    if (ignoreHidden && pathname.isHidden()) {
        return false;
    }

    final String name = pathname.getName();
    for (final Pattern pattern : this.patterns) {
        if (pattern.matcher(name).matches()) {
            return true;
        }
    }
    return false;
}

From source file:org.rhq.enterprise.remoting.cli.ScriptTestRunner.java

private List<Script> findScripts(File dir) throws IOException {
    List<Script> scripts = new ArrayList<Script>();
    File[] paths = dir.listFiles();
    List<File> dirs = new ArrayList<File>();

    for (File path : paths) {
        if (path.isDirectory() && !path.isHidden()) {
            dirs.add(path);/*from   w  w  w.  ja v  a  2  s  .c o  m*/
        } else if (scriptFilter.accept(dir, path.getAbsolutePath())) {
            Script script = new Script();
            script.srcFile = path;
            script.args = findScriptArgs(path);

            scripts.add(script);

            if (singleTestMode) {
                return scripts;
            }
        }
    }

    for (File subdir : dirs) {
        scripts.addAll(findScripts(subdir));
    }

    return scripts;
}

From source file:org.atomserver.core.dbstore.utils.DBPurger.java

private void purgeDirs(String workspace, String collection) throws Exception {
    if (this.contentStorage instanceof FileBasedContentStorage) {
        File rootDir = ((FileBasedContentStorage) this.contentStorage).getRootDir();
        File workspaceDir = new File(rootDir, workspace);
        if (collection != null) {
            File collectionDir = new File(workspaceDir, collection);
            log.info("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
            log.info("==========> DELETING Directory " + collectionDir);
            log.info("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
            FileUtils.deleteDirectory(collectionDir);
        } else {/*from www.  j a  va2  s . c  om*/
            log.info("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
            // WE can't delete workspace dirs (they aren't created magically), so delete all the subdirs
            File[] files = workspaceDir.listFiles();
            if (files != null) {
                for (File subFile : files) {
                    if (subFile.isDirectory() && !subFile.isHidden()) {
                        log.info("==========> DELETING Directory " + subFile);
                        FileUtils.deleteDirectory(subFile);
                    }
                }
            }
            log.info("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
        }
    }
}

From source file:org.isatools.isacreator.formatmappingutility.loader.CSVFileLoader.java

/**
 * File should be checked to determine whether or not it is a directory. if not, then just load the single file
 *
 * @param f - Either a file or pointer to a directory!
 * @return Map<String, String[]> where key is the file name and the String[] is the list of column names
 *///  w w  w. j  a  va2 s .  c  om
public Map<String, String[]> processFile(File f) {
    Map<String, String[]> result = new ListOrderedMap<String, String[]>();

    try {
        File[] files;
        if (f.isDirectory()) {
            files = f.listFiles();
        } else {
            files = new File[] { f };
        }

        for (File file : files) {

            if (!file.isHidden()) {
                String[] firstLine;

                CSVReader reader = new CSVReader(new FileReader(file), delimiter);

                if (delimiter == FileLoader.COMMA_DELIM) {
                    readerUsed = FileLoader.CSV_READER_CSV;
                } else {
                    readerUsed = FileLoader.CSV_READER_TXT;
                }

                int rowOffSet;
                try {
                    rowOffSet = Integer.parseInt(ISAcreatorProperties.getProperty("isacreator.rowOffset")) - 1;
                } catch (NumberFormatException nfe) {
                    rowOffSet = 0;
                }

                for (int skipCount = 0; skipCount < rowOffSet; skipCount++) {
                    reader.readNext();
                }

                firstLine = reader.readNext();

                // clean up
                for (int i = 0; i < firstLine.length; i++) {
                    firstLine[i] = firstLine[i].trim();
                }

                result.put(file.getPath(), firstLine);
            }
        }

    } catch (FileNotFoundException e) {
        log.error("file not found: " + e.getMessage());
    } catch (IOException e) {
        log.error("io exception occurred " + e.getMessage());
    } catch (Exception e) {
        log.error(
                "problem with incoming file. We were unable to process it for this reason: " + e.getMessage());
    }
    return result;

}

From source file:io.proleap.cobol.runner.impl.CobolParseTestRunnerImpl.java

@Override
public void parseDirectory(final File inputDirectory, final CobolSourceFormatEnum format) throws IOException {
    if (inputDirectory.isDirectory() && !inputDirectory.isHidden()) {
        for (final File inputFile : inputDirectory.listFiles()) {
            if (inputFile.isFile() && !inputFile.isHidden() && isCobolFile(inputFile)) {
                parseFile(inputFile, format);
            }//from ww w  .  j  a v a2  s . c o  m
        }
    }
}

From source file:org.geoserver.script.wps.ScriptProcessFactory.java

public Set<Name> getNames() {
    LOGGER.fine("Performing process lookup");

    ScriptManager scriptMgr = scriptMgr();
    Set<Name> names = new TreeSet<Name>();

    try {/* www  . j av a  2  s . c  o m*/
        File wpsRoot = scriptMgr.getWpsRoot();
        for (String file : wpsRoot.list()) {
            File f = new File(wpsRoot, file);
            if (f.isHidden()) {
                continue;
            }
            WpsHook hook = scriptMgr.lookupWpsHook(f);
            if (hook == null) {
                LOGGER.fine("Skipping " + f.getName() + ", no hook found");
            } else {
                //use the extension as the namespace, and the basename as the process name 
                names.add(new NameImpl(getExtension(f.getName()), getBaseName(f.getName())));

                //TODO: support the process defining its namespace
            }
        }
    } catch (IOException e) {
        LOGGER.log(Level.WARNING, "Error looking up processes", e);
    }
    return names;
}

From source file:io.proleap.cobol.parser.runner.impl.CobolParserRunnerImpl.java

protected boolean isRelevant(final File inputFile) {
    return inputFile.isFile() && !inputFile.isHidden() && isCobolFile(inputFile);
}

From source file:nz.ac.otago.psyanlab.common.designer.assets.ImportAssetActivity.java

@Override
public FilenameFilter getfilter() {
    return new FilenameFilter() {
        private Pattern mAllowedFilesPattern = Pattern.compile(Asset.FILE_ENDINGS_IMAGES /*
                                                                                          * +
                                                                                          * "|"
                                                                                          * +
                                                                                          * Asset
                                                                                          * .
                                                                                          * FILE_ENDINGS_SOUNDS
                                                                                          * +
                                                                                          * "|"
                                                                                          * +
                                                                                          * Asset
                                                                                          * .
                                                                                          * FILE_ENDINGS_VIDEOS
                                                                                          */,
                Pattern.CASE_INSENSITIVE);

        @Override//from w  ww  . jav  a2 s . co m
        public boolean accept(File dir, String filename) {
            File f = new File(dir, filename);
            if (f.isHidden()) {
                return false;
            }
            if (f.isDirectory()) {
                return true;
            }
            return mAllowedFilesPattern.matcher(filename).matches();
        }
    };
}

From source file:org.encuestame.business.search.IndexerManager.java

/**
 * Read Files in Attachment Directory./*from ww  w  .ja v a2s  . c  o  m*/
 * @param dataDir Attachment Directory
 * @return
 * @throws Exception
 */
public int index(final File dataDir) throws Exception {
    log.debug("Index file is directory? --->: " + dataDir.isDirectory());
    File[] files = dataDir.listFiles();
    int numberDocs = 0;
    if (files == null) {
        log.debug("No files in the directory ");
    } else {
        numberDocs = this.indexWriterManager.getIndexWriter().numDocs();
        log.debug("List of files in the directory :" + numberDocs);
        for (File f : files) {
            if (!f.isDirectory() && !f.isHidden() && f.exists() && f.canRead()) {
                this.indexFile(f); // Write documents in Index
            }
        }
    }
    return numberDocs;
}