Code examples for File

Codota analyzed 7,668,838 open source code samples to find the most common, credible and clear examples.
You can now enable Codota on your own code to easily search and navigate your Java codebase.
60:	File log = new File(baseDir, "log"); 
-
76:	assertTrue(file + " exists", file.exists()); 
77:	assertTrue(file + " is a directory", file.isDirectory()); 
Full Snippet Info
9
CodeRank
39:	Files.copy(defaultFile, file); 
-
47:	return asFile(new File(name)); 
Full Snippet Info
9
CodeRank
44:	File file = new File(getUserHome(), JLINE_RC); 
45:	if (file.exists() && file.canRead()) { 
-
50:	Log.debug("Loaded user configuration: ", file); 
-
57:	Log.warn("Unable to read user configuration: ", file, e); 
-
61:	Log.trace("User configuration file missing or unreadable: ", file); 
Full Snippet Info
9
CodeRank
70:	if (file.exists()) { 
-
72:	Long loadingDate = loadingDates.get(file); 
-
75:	loadingDate = file.lastModified(); 
-
81:	file.delete(); 
82:	loadingDates.remove(file); 
-
84:	loadingDates.put(file, loadingDate); 
Full Snippet Info
9
CodeRank
122:	newPath = new File(file1+"/"+file2); 
Full Snippet Info
9
CodeRank
48:	"slave-configs/" + dir.getName() + "/domain/configuration/host-slave.xml", dir.getAbsolutePath()); 
Full Snippet Info
9
CodeRank
34:	File baseDir = new File(args[0]); 
35:	if (!baseDir.exists() || !baseDir.isDirectory()) { 
-
52:	ConfigurationAssembler assembler = new ConfigurationAssembler(baseDir, templateFile, "server", subsystemsFile, outputFile); 
Full Snippet Info
9
CodeRank
38:	File path = new File(desc.filenameFor(Component.PRIMARY_INDEX)); 
39:	in = RandomAccessReader.open(path); 
Full Snippet Info
9
CodeRank
38:	long length = new File(path).length(); 
Full Snippet Info
9
CodeRank
48:	archive.addAsResource(new File(resourceURL.getFile()), path); 
Full Snippet Info
9
CodeRank
136:	if (dest.exists() && !dest.delete()) { 
-
138:	"Destination file [" + dest.getAbsolutePath() + "] already exists and could not be deleted"); 
-
142:	this.fileItem.write(dest); 
-
150:	action + " to [" + dest.getAbsolutePath() + "]"); 
Full Snippet Info
8
CodeRank
75:	if (file != null && file.exists()) { 
-
77:	Long loadingDate = loadingDates.get(file); 
-
80:	loadingDate = file.lastModified(); 
-
86:	file.delete(); 
87:	loadingDates.remove(file); 
-
89:	loadingDates.put(file, loadingDate); 
Full Snippet Info
8
CodeRank
98:	assertNotNull(dir); 
99:	assertTrue(dir.getAbsolutePath().contains(NativeAppCallAttachmentStore.ATTACHMENTS_DIR_NAME)); 
100:	assertTrue(dir.getAbsolutePath().contains(CALL_ID.toString())); 
Full Snippet Info
8
CodeRank
110:	File outputDir = new File(output); 
-
117:	if (!outputDir.exists()) { 
118:	if (!outputDir.mkdirs()) { 
119:	log.warn("Failed to create CSV metrics dir {}", outputDir); 
-
123:	csvReporter = CsvReporter.forRegistry(getRegistry()).build(outputDir); 
Full Snippet Info
8
CodeRank
55:	f.renameTo(new File("/sdcard" + file)); 
Full Snippet Info
9
CodeRank
51:	file.mkdirs(); 
-
53:	AtomicFile aFile = new AtomicFile(file); 
-
58:	Log.e(TAG, "Cannot write file " + file.getPath()); 
-
103:	writeFile(new File(getContext().getFilesDir(), "system/packages-stopped.xml"), 
Full Snippet Info
8
CodeRank
49:	archive.addAsResource(new File(resourceURL.getFile()), path); 
Full Snippet Info
9
CodeRank
18:	File storageDir = new File(location); 
-
20:	if (storageDir.exists() && storageDir.isFile()) 
-
23:	if (!storageDir.exists() && !storageDir.mkdirs()) 
Full Snippet Info
8
CodeRank
27:	File homefile = new File(homedir); 
28:	if (!homefile.exists()) homefile.mkdirs(); 
Full Snippet Info
8
CodeRank
62:	if (classpathFile.exists() && !classpathFiles.contains(classpathFile)) { 
63:	classpathFiles.add(classpathFile); 
64:	addManifestClasspathFiles(classpathFile, classpathFiles); 
Full Snippet Info
8
CodeRank