Java Code Examples for java.nio.file.Files.isHidden()

The following are Jave code examples for showing how to use isHidden() of the java.nio.file.Files class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: alfresco-repository   File: HiddenFileFilter.java   Source Code and License Vote up 6 votes
/**
 * @see org.alfresco.repo.bulkimport.ImportFilter#shouldFilter(org.alfresco.repo.bulkimport.ImportableItem)
 */
public boolean shouldFilter(final ImportableItem importableItem)
{
    boolean result = false;
    
    if (importableItem.getHeadRevision().contentFileExists())
    {
        Path file = importableItem.getHeadRevision().getContentFile();
        try
        {
            result = Files.isHidden(file);
        }
        catch (IOException e)
        {
        }
    }

    return(result);
}
 
Example 2
Project: incubator-netbeans   File: NbMavenProjectImpl.java   Source Code and License Vote up 5 votes
private boolean isOtherRoot(Path dir) throws IOException {
    if (!dir.toFile().isDirectory() || Files.isHidden(dir)) {
        return false;
    }

    // Walk through the other roots and check if a parent of this dir is
    // already available in other roots to avoid folder duplication
    for (Path path : otherRoots) {
        if (dir.startsWith(path)) {
            return false;
        }
    }
    return true;
}
 
Example 3
Project: powsybl-core   File: DefaultLocalFolderScanner.java   Source Code and License Vote up 5 votes
@Override
public LocalFolder scanFolder(Path path, LocalFolderScannerContext context) {
    try {
        if (Files.isDirectory(path) && !Files.isHidden(path)) {
            return new DefaultLocalFolder(path, context.getRootDir(), context.getFileSystemName());
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
    return null;
}
 
Example 4
Project: JavaRushTasks   File: Solution.java   Source Code and License Vote up 5 votes
public Solution(String pathToFile) {

        try {
            Path filePath = Paths.get(pathToFile);
            fileData = new ConcreteFileData(Files.isHidden(filePath), Files.isExecutable(filePath),
                    Files.isDirectory(filePath), Files.isWritable(filePath));

        } catch (Exception e) {
            fileData = new NullFileData (e);
        }
    }
 
Example 5
Project: SpaceGame   File: LevelEventRegistry.java   Source Code and License Vote up 5 votes
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
    if (!Files.isHidden(file) && Files.exists(file, LinkOption.NOFOLLOW_LINKS)) {
        try {
            String name = file.toString()
                    .substring(0, file.toString().lastIndexOf('.'))
                    .replaceFirst("/images/", "");
            byte[] bytes = Files.readAllBytes(file);
            packer.pack(name, new Pixmap(bytes, 0, bytes.length));
        } catch (GdxRuntimeException e) {
            System.err.println("Failed to load file: " + file + " as an image.");
        }
    }
    return FileVisitResult.CONTINUE;
}
 
Example 6
Project: SpaceGame   File: Level.java   Source Code and License Vote up 5 votes
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
    if (!Files.isHidden(file) && Files.exists(file, LinkOption.NOFOLLOW_LINKS)) {
        try {
            String name = file.toString()
                    .replaceFirst("/sounds/", "");
            int lastIndex = name.lastIndexOf('/');
            consumer.accept(name, Gdx.audio.newSound(new PathFileHandle(
                    lastIndex >= 0 ? name.substring(lastIndex) : name, file)));
        } catch (GdxRuntimeException e) {
            System.err.println("Failed to load file: " + file + " as a sound.");
        }
    }
    return FileVisitResult.CONTINUE;
}
 
Example 7
Project: openjdk-jdk10   File: ModulePath.java   Source Code and License Vote up 5 votes
/**
 * Returns true if the given file exists and is a hidden file
 */
private boolean isHidden(Path file) {
    try {
        return Files.isHidden(file);
    } catch (IOException ioe) {
        return false;
    }
}
 
Example 8
Project: openjdk-jdk10   File: ModulePatcher.java   Source Code and License Vote up 5 votes
/**
 * Returns true if the given file exists and is a hidden file
 */
private boolean isHidden(Path file) {
    try {
        return Files.isHidden(file);
    } catch (IOException ioe) {
        return false;
    }
}
 
Example 9
Project: jdk8u-jdk   File: FaultyFileSystem.java   Source Code and License Vote up 4 votes
@Override
public boolean isHidden(Path file) throws IOException {
    triggerEx(file, "isHidden");
    return Files.isHidden(unwrap(file));
}
 
Example 10
Project: openjdk-jdk10   File: FaultyFileSystem.java   Source Code and License Vote up 4 votes
@Override
public boolean isHidden(Path file) throws IOException {
    triggerEx(file, "isHidden");
    return Files.isHidden(unwrap(file));
}