private boolean shouldProcess(File f) { if (f.isFile()) { return true; } if (!create) { return false; } Exception exception = null; try { if (FILE_UTILS.createNewFile(f, mkdirs)) { return true; } } catch (IOException e) { exception = e; } String msg = "Unable to create " + f; if (exception == null) { log(msg, Project.MSG_WARN); return false; } throw new BuildException(msg, exception); }
private void touch(File file, long modTime) { if (!file.exists()) { log("Creating " + file, ((verbose) ? Project.MSG_INFO : Project.MSG_VERBOSE)); try { FILE_UTILS.createNewFile(file, mkdirs); } catch (IOException ioe) { throw new BuildException("Could not create " + file, ioe, getLocation()); } } if (!file.canWrite()) { throw new BuildException( "Can not change modification date of read-only file %s", file); } FILE_UTILS.setFileLastModified(file, modTime); }
/** * Validate that the task parameters are valid. * * @throws BuildException if parameters are invalid */ private void validate() throws BuildException { if (null == myFile) { myFile = FILE_UTILS.resolveFile(getProject().getBaseDir(), DEFAULT_FILENAME); } if (!myFile.exists()) { try { FILE_UTILS.createNewFile(myFile); } catch (final IOException ioe) { throw new BuildException( myFile + " doesn't exist and new file can't be created.", ioe); } } if (!myFile.canRead()) { throw new BuildException("Unable to read from " + myFile + "."); } if (!myFile.canWrite()) { throw new BuildException("Unable to write to " + myFile + "."); } } }
try { FILE_UTILS.createNewFile(tempFile); long localTimeStamp = tempFile.lastModified(); BufferedInputStream instream = new BufferedInputStream(new FileInputStream(tempFile));
try { FILE_UTILS.createNewFile(tempFile); long localTimeStamp = tempFile.lastModified(); BufferedInputStream instream = new BufferedInputStream(Files.newInputStream(tempFile.toPath()));
try { FILE_UTILS.createNewFile(tempFile); long localTimeStamp = tempFile.lastModified(); BufferedInputStream instream = new BufferedInputStream(Files.newInputStream(tempFile.toPath()));
try { FILE_UTILS.createNewFile(tempFile); long localTimeStamp = tempFile.lastModified(); BufferedInputStream instream = new BufferedInputStream(new FileInputStream(tempFile));
if (this.mforce || !this.fileUtils.isUpToDate(inFile, outFile)) { this.fileUtils.createNewFile(outFile, true); Converter.getInstance().convert(inFile, outFile, this.moutType, this.context);