List of usage examples for java.io File isHidden
public boolean isHidden()
From source file:com.hypersocket.server.handlers.impl.FileContentHandler.java
@Override public int getResourceStatus(String path) { try {//from w w w . j a v a 2 s .c om File f = resolveFile(path); if (f.isHidden() || !f.exists()) { return HttpStatus.SC_NOT_FOUND; } if (!f.isFile()) { return HttpStatus.SC_FORBIDDEN; } return HttpStatus.SC_OK; } catch (FileNotFoundException e) { return HttpStatus.SC_NOT_FOUND; } }
From source file:org.geotools.gce.imagepyramid.Utils.java
/** * Prepares a message with the status of the provided file. * @param sourceFile The {@link File} to provided the status message for * @return a status message for the provided {@link File} or a {@link NullPointerException} in case the {@link File}is <code>null</code>. *//*from w w w. j av a2 s .com*/ private static String fileStatus(File sourceFile) { if (sourceFile == null) { throw new NullPointerException("Provided null input to fileStatus method"); } final StringBuilder builder = new StringBuilder(); builder.append("Checking file:").append(FilenameUtils.getFullPath(sourceFile.getAbsolutePath())) .append("\n"); builder.append("exists").append(sourceFile.exists()).append("\n"); builder.append("isFile").append(sourceFile.isFile()).append("\n"); builder.append("canRead:").append(sourceFile.canRead()).append("\n"); builder.append("canWrite").append(sourceFile.canWrite()).append("\n"); builder.append("canExecute").append(sourceFile.canExecute()).append("\n"); builder.append("isHidden:").append(sourceFile.isHidden()).append("\n"); builder.append("lastModified").append(sourceFile.lastModified()).append("\n"); return builder.toString(); }
From source file:br.msf.commons.util.IOUtils.java
public static boolean isHidden(final File file) { return file != null && file.isHidden(); }
From source file:br.msf.commons.util.IOUtils.java
public static boolean isNotHidden(final File file) { return file == null || !file.isHidden(); }
From source file:lineage2.commons.data.xml.AbstractDirParser.java
/** * Method parse.//from w w w . j a v a 2 s. com */ @Override protected final void parse() { File dir = getXMLDir(); if (!dir.exists()) { warn("Dir " + dir.getAbsolutePath() + " not exists"); return; } File dtd = new File(dir, getDTDFileName()); if (!dtd.exists()) { info("DTD file: " + dtd.getName() + " not exists."); return; } initDTD(dtd); try { Collection<File> files = FileUtils.listFiles(dir, FileFilterUtils.suffixFileFilter(".xml"), FileFilterUtils.directoryFileFilter()); for (File f : files) { if (!f.isHidden()) { if (!isIgnored(f)) { try { parseDocument(new FileInputStream(f), f.getName()); } catch (Exception e) { info("Exception: " + e + " in file: " + f.getName(), e); } } } } } catch (Exception e) { warn("Exception: " + e, e); } }
From source file:org.jboss.windup.util.RecursiveDirectoryMetaFactory.java
protected void populateChildren(DirectoryMetadata parent) { File[] files = parent.getFilePointer().listFiles(); if (LOG.isDebugEnabled()) { LOG.debug(files.length + " Children of " + parent.getFilePointer().getAbsolutePath()); }//from w w w . j a va2s. co m for (File file : files) { if (file.isDirectory()) { if (file.isHidden()) { LOG.debug("Skipping hidden directory: " + file.getAbsolutePath()); continue; } DirectoryMetadata dirMeta = new DirectoryMetadata(); parent.getNestedArchives().add(dirMeta); dirMeta.setArchiveMeta(parent); dirMeta.setFilePointer(file); dirMeta.setRelativePath(generateRelativePath(file)); dirMeta.setName(file.getName()); if (LOG.isTraceEnabled()) { LOG.trace("Added child: " + dirMeta.getRelativePath()); } populateChildren(dirMeta); } } }
From source file:de.fu_berlin.inf.dpp.intellij.project.filesystem.IntelliJFolderImpl.java
@Override public IResource[] members(int memberFlags) { List<IResource> list = new ArrayList<IResource>(); File[] files = getLocation().toFile().listFiles(); if (files == null) return list.toArray(new IResource[] {}); for (File myFile : files) { if (myFile.isFile() && !myFile.isHidden() && (memberFlags == NONE || memberFlags == FILE)) { list.add(new IntelliJFileImpl(project, myFile)); }/*from w ww . j a va2s .co m*/ if (myFile.isDirectory() && !myFile.isHidden() && (memberFlags == NONE || memberFlags == FOLDER)) { list.add(new IntelliJFolderImpl(project, myFile)); } } return list.toArray(new IResource[] {}); }
From source file:org.apereo.portal.utils.AntPatternFileFilter.java
@Override public boolean accept(File pathname) { if (ignoreHidden && pathname.isHidden()) { return false; }/*from w w w. ja v a 2 s . c o m*/ final String path; try { path = pathname.getCanonicalPath(); } catch (IOException e) { throw new RuntimeException("Could not determine canonical path of: " + pathname, e); } return accept(pathname, path); }
From source file:eu.planets_project.services.utils.ZipUtils.java
/** * @param dir The dir to list/*from ww w .j av a2 s . c o m*/ * @param list The list to add the contents of dir to * @return The given list, with the contents of dir added, including files and folders */ static List<File> listAllFilesAndFolders(final File dir, final List<File> list) { File[] files = dir.listFiles(); if (files != null) { for (int i = 0; i < files.length; i++) { File currentFile = files[i]; boolean currentFileIsDir = currentFile.isDirectory(); if (currentFileIsDir) { // Ignore hidden folders if (currentFile.isHidden()) { continue; } if (currentFile.getName().equalsIgnoreCase("CVS")) { continue; } list.add(currentFile); listAllFilesAndFolders(currentFile, list); } else { list.add(currentFile); } } } return list; }
From source file:org.ops4j.pax.url.dir.internal.FileTailImpl.java
/** * Tries to find the parent of tail in sub folders of folder parameter. * Tail is a relative path to a file in any depth of folder parameter. * It will recursively call this method trying to find the given tail's parent. * * Note: THIS is being called recursively !! * * @param folder local folder that is used as (current) root. Sub folders wll be crawled recursively. * * @return the parent folder of the given anchor * * @throws java.io.IOException if a problem occures while crawling subfolders of *folder* *///from w ww . j a v a 2 s . co m protected File findParentOfTail(File folder) throws IOException { logger.debug("findParentOfTail " + folder.getAbsolutePath()); for (File f : folder.listFiles()) { if (!f.isHidden() && f.isDirectory()) { File r = findParentOfTail(f); if (r != null) { return r; } } else if (!f.isHidden()) { String p = f.getCanonicalPath().replaceAll("\\\\", "/"); if (p.endsWith(m_tail)) { return new File( f.getCanonicalPath().substring(0, f.getCanonicalPath().length() - m_tail.length())); } } } return null; }