final String relativePath = getRelativePath(folder, data); try { retval = FileUtil.createData(folderFo,relativePath); } catch (IOException ex) { retval = FileUtil.createData(folderFo,relativePath);
/** Creates a file object that will mask the given file. * @param fs filesystem to work on * @param res resource name of the file * @exception IOException if it fails */ void maskFile(FileSystem fs, String res) throws IOException { FileObject where = findResourceOn(fs, fs.getRoot().getPath()); FileUtil.createData(where, res + MASK); }
} else { FileObject fd = createData(fo, name); FileLock lock = fd.lock();
FileUtil.createData(root(simple), fullName);
private File getLogFile(String timestamp) throws IOException { File f = new File(directory, prefix + timestamp + suffix); try { FileUtil.createData(f); } catch (IOException ex) { // this can happen when directory is RO for netbeans LOGGER.log(Level.INFO, null, ex); return null; } return f; }
private Properties getProjectProperties(FileObject projectDir) throws IOException { FileObject projectProperties = FileUtil.createData(projectDir, AntProjectHelper.PROJECT_PROPERTIES_PATH); InputStream propertiesIS = projectProperties.getInputStream(); Properties props = new Properties(); props.load(propertiesIS); propertiesIS.close(); return props; } }
private static FileObject createFileObject(FileObject dir, String relToDir) throws IOException { FileObject createdFO = dir.getFileObject(relToDir); if (createdFO != null) { throw new IllegalArgumentException("File " + createdFO + " already exists."); // NOI18N } createdFO = FileUtil.createData(dir, relToDir); return createdFO; }
public void run() throws IOException { FileObject rakeTasksFile = projectDir.getFileObject(RAKE_D_OUTPUT); if (rakeTasksFile != null) { rakeTasksFile.delete(); } rakeTasksFile = FileUtil.createData(projectDir, RAKE_D_OUTPUT); OutputStream os = rakeTasksFile.getOutputStream(); Writer writer = new BufferedWriter(new OutputStreamWriter(os)); try { writer.write(rakeDOutput); } finally { writer.close(); } } });
@Override public void run(FileSystem layer) throws IOException { FileObject fo = FileUtil.createFolder(layer.getRoot(), "Windows2/Modes"); for (Map.Entry<String, String> entry : newModes.entrySet()) { FileObject wsmode = FileUtil.createData(fo, entry.getKey() + ".wsmode"); OutputStream os = wsmode.getOutputStream(); try { os.write(entry.getValue().getBytes("UTF-8")); } finally { os.close(); } } } }, files));
public void run() throws IOException { FileObject detailForm = FileUtil.createData(jsfRoot, name);//NOI18N FileLock lock = detailForm.lock(); try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(detailForm.getOutputStream(lock), encoding)); bw.write(content); bw.close(); } finally { lock.releaseLock(); } } });
private void create() throws IOException { File parent = f.getParentFile(); FileObject parentFo = FileUtil.createFolder(parent); assert parentFo != null; FileObject template = FileUtil.getConfigFile("Templates/Classes/Empty.java"); //NOI18N FileObjectFromTemplateCreator creator = Lookup.getDefault().lookup(FileObjectFromTemplateCreator.class); if (template == null || creator == null) { FileUtil.createData(parentFo, f.getName()); return; } FileObject newFO = creator.create(template, parentFo, f.getName()); assert newFO != null; } }
private static void createSeparator ( FileObject folder, String name, int position ) throws IOException { FileObject separator = FileUtil.createData(folder, name + ".instance"); separator.setAttribute ("instanceClass", "javax.swing.JSeparator"); separator.setAttribute("position", position); }
/******************************************************************************************************************* * * * ******************************************************************************************************************/ @PostConstruct public void initialize() // FIXME: private throws IOException { log.info("initialize()"); persistenceFile = FileUtil.createData(FileUtil.getConfigRoot(), "Archive/UniformityMeasurements.txt"); log.info(">>>> persistenceFile: {}", persistenceFile.getPath()); loadArchive(); }
protected final FileObject getPropertyFile() throws IOException { if (propertiesFile == null) { FileObject projectDirectory = getProject().getProjectDirectory(); propertiesFile = FileUtil.createData(projectDirectory, propertyPath); } return propertiesFile; }
/** Creates a file object that will mask the given file. * @param fs filesystem to work on * @param res resource name of the file * @exception IOException if it fails */ void maskFile (FileSystem fs, String res) throws IOException { FileObject where = findResourceOn (fs,fs.getRoot().getPath ()); FileUtil.createData (where, res + MASK); }
/** Creates a file object that will mask the given file. * @param fs filesystem to work on * @param res resource name of the file * @exception IOException if it fails */ void maskFile (FileSystem fs, String res) throws IOException { FileObject where = findResourceOn (fs,fs.getRoot().getPath ()); FileUtil.createData (where, res + MASK); }
public void run() throws IOException { FileObject fo = FileUtil.createData(rootFo, fullPath); FileLock lock = fo.lock(); try { OutputStream os = fo.getOutputStream(lock); writer.writeTo(os); } finally { lock.releaseLock(); } } } );
@Override public void run() throws IOException { FileObject prjDir = getProject().getProjectDirectory(); FileObject bundleFO = FileUtil.createData(prjDir, bundlePath); EditableProperties ep = Util.loadProperties(bundleFO); ep.setProperty(key, value); Util.storeProperties(bundleFO, ep); } }
public static void saveToFile(final @NonNull FileObject dirFO, final @NonNull String relativePath, final @NonNull EditableProperties ep) throws IOException { assert dirFO.isFolder(); FileObject f = dirFO.getFileObject(relativePath); final FileObject propsFO; if(f == null) { propsFO = FileUtil.createData(dirFO, relativePath); assert propsFO != null : "FU.cD must not return null; called on " + dirFO + " + " + relativePath; // #50802 // NOI18N } else { propsFO = f; } saveToFile(propsFO, ep); }
@Override public void run() throws IOException { FileObject target = FileUtil.createData(getProject().getProjectDirectory(), path); if (tokens == null) { copyByteAfterByte(content, target); } else { copyAndSubstituteTokens(content, target, tokens); } // #129446: form editor doesn't work sanely unless you do this: if (target.hasExt("form")) { // NOI18N FileObject java = FileUtil.findBrother(target, "java"); // NOI18N if (java != null) { java.setAttribute("justCreatedByNewWizard", true); // NOI18N } } else if (target.hasExt("java") && FileUtil.findBrother(target, "form") != null) { // NOI18N target.setAttribute("justCreatedByNewWizard", true); // NOI18N } } }