public virtual bool accept(File dir) { if (dir.isDirectory() && this.acceptsDirectories()) return true; for (int index = 0; index < this.fileext.Length; ++index) { if (String.instancehelper_endsWith(dir.getName(), this.fileext[index])) return true; } return false; }
public bool accept(File file) { if (file.isDirectory()) { Matcher matcher = field_22214_a.matcher(file.getName()); return matcher.matches(); } else { return false; } }
public FileMatcher(File file) { field_22209_a = file; Matcher matcher = ChunkFilePattern.field_22119_a.matcher(file.getName()); if (matcher.matches()) { field_22208_b = Integer.parseInt(matcher.group(1), 36); field_22210_c = Integer.parseInt(matcher.group(2), 36); } else { field_22208_b = 0; field_22210_c = 0; } }
public void TestTikaAutodetect() { Tika tika = new Tika(); File xpsFile = new File("samples\\test1.xps"); if (!xpsFile.isFile()) throw new Exception(xpsFile.getName() + " does not exists."); using (InputStream inputStream = new FileInputStream(xpsFile)) { Metadata metadata = new Metadata(); string mimeType = tika.detect(inputStream, metadata); Assert.AreEqual("application/x-tika-ooxml", mimeType); inputStream.close(); } }
public virtual bool accept(File file) { return file.isDirectory() || String.instancehelper_endsWith(String.instancehelper_toLowerCase(file.getName()), this.extension); }
protected override void onListItemClick(ListView l, android.view.View v, int position, long id) { File file = new File((string)path.get(position)); if (file.isDirectory()) { if (file.canRead()) { getDir((string)path.get(position)); } else { new AlertDialog.Builder(this) //.setIcon(R.drawable.ic_launcher) .setTitle(file.getName() + "] folder can't be read!") //.setPositiveButton("OK", null) .show(); } } else { new AlertDialog.Builder(this) //.setIcon(R.drawable.ic_launcher) .setTitle(file.getName() + "]") //.setPositiveButton("OK", null) .show(); } }
private void exploreDirectory(ZipOutputStream zipStream, String root, File directory) { if (directory.isHidden()) { return; } foreach (var content in directory.list()) { var file = new File(directory, content); if (file.isDirectory()) { exploreDirectory(zipStream, root + directory.getName() + '/', file); } else { addEntry(zipStream, root + directory.getName() + '/', file); } } }
private void addEntry(ZipOutputStream zipStream, String root, File file) { if (file.isHidden()) { return; } var name = root + file.getName(); var zipEntry = new ZipEntry(name); zipStream.putNextEntry(zipEntry); var buffer = new byte[4096]; var inputStream = new FileInputStream(file); int read; while ((read = inputStream.read(buffer)) != -1) { zipStream.write(buffer, 0, read); } }