List of usage examples for java.io File isHidden
public boolean isHidden()
From source file:org.saiku.service.importer.impl.LegacyImporterImpl.java
public void importDatasources() { setPath("res:legacy-datasources"); try {/* www. j av a2 s. co m*/ if (repoURL != null) { File[] files = new File(repoURL.getFile()).listFiles(); if (files != null) { for (File file : files) { if (!file.isHidden() && !file.getName().equals("README")) { Properties props = new Properties(); try { props.load(new FileInputStream(file)); } catch (IOException e) { e.printStackTrace(); } String name = props.getProperty("name"); String type = props.getProperty("type"); if (props.getProperty("location") != null) { String toSplit = props.getProperty("location"); String[] split = toSplit.split(";"); for (int i = 0; i < split.length; i++) { String s = split[i]; if (s.startsWith("Catalog=")) { Path p = Paths.get(s.substring(8, s.length())); String f = p.getFileName().toString(); String fixedString = "Catalog=mondrian:///datasources/" + f; split[i] = fixedString; StringBuilder builder = new StringBuilder(); for (String str : split) { builder.append(str).append(";"); } props.setProperty("location", builder.toString()); } } } if (name != null && type != null) { props.put("id", java.util.UUID.randomUUID().toString()); props.put("advanced", "true"); SaikuDatasource.Type t = SaikuDatasource.Type.valueOf(type.toUpperCase()); SaikuDatasource ds = new SaikuDatasource(name, t, props); dsm.addDatasource(ds); } } } } } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.sakaiproject.content.chh.file.ContentCollectionFileSystem.java
/** * Returns a list of String Ids of the members of this collection (i.e. files in this directory). * /*from ww w . ja v a 2s.c o m*/ * @return a list of the String Ids of the members of this collection (i.e. files in this directory). Returns empty list if this is not a directory, no-longer exists, or is inaccessible. */ public List getMembers() { if (!this.searchable) { // Trap requests from sakai-search to prevent it digging into the virtual filesystem // Can anyone think of a non-evil way of doing this check? I look in the stack trace // to find a particular method in the search engine's call signature :-S boolean requestIsFromSakaiSearch = false; try { throw new Exception(); } catch (Exception e) { StackTraceElement te[] = e.getStackTrace(); if (te != null && te.length > 1 && te[te.length - 2].getClassName() .equals("org.sakaiproject.search.component.service.impl.SearchIndexBuilderWorkerImpl")) requestIsFromSakaiSearch = true; } if (requestIsFromSakaiSearch) return new ArrayList(); } try { String[] contents = file.list(); ArrayList<String> mems = new ArrayList<String>(contents.length); String newpath = getId(); if (newpath.charAt(newpath.length() - 1) != '/') newpath = newpath + "/"; for (int x = 0; x < contents.length; ++x) { File ftmp = new File(newpath + contents[x]); if (!showHiddenFiles && (ftmp.isHidden() || ftmp.getName().startsWith("."))) continue; if (ftmp.isDirectory()) mems.add(newpath + contents[x] + "/"); else mems.add(newpath + contents[x]); } return mems; } catch (Exception e) { log.warn("Unable to list members of virtual collection [" + getId() + "]"); } return new ArrayList(); }
From source file:org.codehaus.mojo.latex.LaTeXMojo.java
private File[] getDocDirs() { return docsRoot.listFiles(new FileFilter() { @Override/*from ww w . j av a2 s. com*/ public boolean accept(File pathname) { return pathname.isDirectory() && !(pathname.getName().equals(commonsDirName)) && !(pathname.isHidden()); } }); }
From source file:com.opengamma.engine.position.csv.CSVPositionSource.java
/** * Populate the portfolio identifiers from the base directory. *///w ww.j a v a2s .com private void populatePortfolioIds() { File[] filesInBaseDirectory = getBaseDirectory().listFiles(); for (File file : filesInBaseDirectory) { if (file.isFile() == false || file.isHidden() || file.canRead() == false) { continue; } String portfolioName = buildPortfolioName(file.getName()); _portfolios.put(ObjectId.of("CSV-" + file.getName(), portfolioName), file); } }
From source file:com.devbury.mkremote.server.QuickLaunchServiceImpl.java
public ArrayList<LaunchItem> list(String dir) { Base64 base64 = new Base64(); JFileChooser chooser = new JFileChooser(); File new_dir = newFileDir(dir); logger.debug("Looking for files in {}", new_dir.getAbsolutePath()); ArrayList<LaunchItem> items = new ArrayList<LaunchItem>(); if (isSupported()) { if (new_dir.isDirectory()) { FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { return !name.startsWith("."); }/*from w w w .j a va 2 s. com*/ }; for (File f : new_dir.listFiles(filter)) { if (!f.isHidden()) { LaunchItem item = new LaunchItem(); item.setName(f.getName()); item.setPath(dir); if (f.isDirectory()) { if (isMac() && f.getName().endsWith(".app")) { item.setType(LaunchItem.FILE_TYPE); item.setName(f.getName().substring(0, f.getName().length() - 4)); } else { item.setType(LaunchItem.DIR_TYPE); } } else { item.setType(LaunchItem.FILE_TYPE); } Icon icon = chooser.getIcon(f); BufferedImage bi = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_RGB); icon.paintIcon(null, bi.createGraphics(), 0, 0); ByteArrayOutputStream os = new ByteArrayOutputStream(); try { ImageIO.write(bi, "png", os); item.setIcon(base64.encodeToString(os.toByteArray())); } catch (IOException e) { logger.debug("could not write image {}", e); item.setIcon(null); } logger.debug("Adding LaunchItem : {}", item); items.add(item); } else { logger.debug("Skipping hidden file {}", f.getName()); } } } } else { new Thread() { @Override public void run() { JOptionPane.showMessageDialog(null, "We are sorry but quick launch is not supported on your platform", "Quick Launch Not Supported", JOptionPane.ERROR_MESSAGE); } }.start(); } return items; }
From source file:com.qwazr.database.TableManager.java
public Set<String> getNameSet() { rwl.r.lock();//from w w w . j ava 2 s .co m try { LinkedHashSet<String> names = new LinkedHashSet<String>(); for (File file : directory.listFiles((FileFilter) FileFilterUtils.directoryFileFilter())) if (!file.isHidden()) names.add(file.getName()); return names; } finally { rwl.r.unlock(); } }
From source file:com.appspresso.api.fs.DefaultFile.java
/** * {@inheritDoc}//from ww w .j a va 2 s .c om * */ private boolean isHiddenFile(File file) { if (file.isHidden()) { if (L.isWarnEnabled()) { L.warn("It's the hidden file."); } return true; } return false; }
From source file:won.preprocessing.GateRESCALProcessing.java
/** * After the mails have been preprocessed the Gate processing and tensor creation is executed by the gate * application.//from ww w. j a v a 2 s. c o m * * @param corpusFolder corpus document input folder * @throws gate.util.GateException * @throws MalformedURLException */ public void processFilesWithGate(String corpusFolder) throws IOException, ResourceInstantiationException, ExecutionException { int maxFilesPerCorpus = 1000; int processedFiles = 0; logger.info("Gate processing and tensor creation of files from folder: {}", corpusFolder); File folder = new File(corpusFolder); for (int bulk = 0; bulk < folder.listFiles().length; bulk += maxFilesPerCorpus) { Corpus corpus = Factory.newCorpus("Transient Gate Corpus"); for (int i = bulk; i < maxFilesPerCorpus + bulk && i < folder.listFiles().length; i++) { File file = folder.listFiles()[i]; if (!file.isDirectory() && !file.isHidden()) { corpus.add(Factory.newDocument(file.toURI().toURL())); } } gateApplication.setCorpus(corpus); gateApplication.execute(); addDataFromProcessedCorpus(corpus); processedFiles += corpus.size(); logger.info("{} files processed ...", processedFiles); } }
From source file:com.example.lista3new.SyncService.java
private List<File> getLocalFileList(final String dirPath) { List<File> fileList = null; FilenameFilter filter = new FilenameFilter() { @Override//w w w .j av a2 s . co m public boolean accept(final File dir, final String filename) { File sel = new File(dir, filename); return ((sel.isFile() || sel.isDirectory()) && !sel.isHidden()); } }; File file = new File(dirPath); if (!file.exists()) { file.mkdirs(); } fileList = Arrays.asList(file.listFiles(filter)); return fileList; }
From source file:com.lsjwzh.widget.recyclerviewpagerdeomo.MainActivity.java
public ArrayList<String> getFilesList(String filePath) { ArrayList<String> list = new ArrayList<>(); File file = new File(filePath); File[] files = file.listFiles(new FilenameFilter() { @Override//from ww w . java 2 s . co m public boolean accept(File dir, String filename) { if (filename.startsWith(".")) { return false; } return true; } }); if (files == null) { Log.d(TAG, "getFileList: files null "); } else { ArrayList<FileInfo> fs = new ArrayList<>(); for (File child : files) { if (!child.isDirectory() && !child.isHidden()) { if (child.getAbsolutePath().toLowerCase().endsWith(".png") || child.getAbsolutePath().toLowerCase().endsWith(".jpg") || child.getAbsolutePath().toLowerCase().endsWith(".gif")) { FileInfo info = new FileInfo(); info.fileName = child.getName(); info.filePath = child.getAbsolutePath(); info.ModifiedDate = child.lastModified(); info.create_time = info.ModifiedDate; info.fileSize = child.length(); fs.add(info); } } } for (int i = 0; i < fs.size(); i++) { list.add(fs.get(i).filePath); } } return list; }