public OutputStream getOutputStream(FileLock lock) throws java.io.IOException { return fileObj.getOutputStream(lock); }
newUserDefinedFO.setAttribute(USER_DEFINED_MIME_RESOLVER, Boolean.TRUE); newUserDefinedFO.setAttribute("position", USER_DEFINED_MIME_RESOLVER_POSITION); //NOI18N os = newUserDefinedFO.getOutputStream(); XMLUtil.write(document, os, "UTF-8"); //NOI18N } catch (IOException e) {
InputStream is = fo.openInputStream(); org.openide.filesystems.FileObject tmp = FileUtil.createMemoryFileSystem().getRoot().createData("resolver.xml"); OutputStream os = tmp.getOutputStream(); for (;;) { int ch = is.read();
OutputStream os = fd.getOutputStream(lock);
public OutputStream getOutputStream() throws IOException, UnknownServiceException { connect(); if (fo.isFolder()) { throw new UnknownServiceException(); } if (oStream == null) { FileLock flock = fo.lock(); oStream = new LockOS(fo.getOutputStream(flock), flock); } return oStream; }
final OutputStream os; try { os = getOutputStream(lock); return new FilterOutputStream(os) { @Override
bufOut = dest.getOutputStream(lock);
public OutputStream getOutputStream(FileLock lock) throws java.io.IOException { MfLock l; FileLock lWritable; FileObject fo; try { getFileSystem().beginAtomicAction(markAtomicAction); synchronized (this) { l = testLock(lock); // this can also change lock in l.lock fo = writable(false); lWritable = l.findLock(fo); } return fo.getOutputStream(lWritable); } finally { getFileSystem().finishAtomicAction(); } }
private static void writeFile(ZipInputStream str, FileObject fo) throws IOException { try (OutputStream out = fo.getOutputStream()) { FileUtil.copy(str, out); } }
private static void writeFile(ZipInputStream str, FileObject fo) throws IOException { OutputStream out = fo.getOutputStream(); try { FileUtil.copy(str, out); } finally { out.close(); } }
private void saveProjectProperties(Properties props) { OutputStream os = null; try { os = getProjectPropertiesFile().getOutputStream(); props.store(os, ""); // NOI18N } catch (IOException e) { } finally { try { os.close(); } catch (Exception e) {} } }
public void run() throws IOException { OutputStream out = null; try { out = parent.createData(name).getOutputStream(); out.write(buffer); } finally { if (out != null) try {out.close();} catch (IOException e) {} } } });
private static void writeFile(ZipInputStream str, FileObject fo) throws IOException { try (OutputStream out = fo.getOutputStream()) { FileUtil.copy(str, out); } }
private static void writeFile(ZipInputStream str, FileObject fo) throws IOException { OutputStream out = fo.getOutputStream(); try { FileUtil.copy(str, out); } finally { out.close(); } }
private void save(FieldTask task, FileObject targetFile) { LOGGER.log(Level.FINEST, "saving field object to file {0}", targetFile.getName()); assert FieldTask.EXT.equals(targetFile.getExt()) : "Can only save Fields"; try (ObjectOutputStream oos = new ObjectOutputStream(targetFile.getOutputStream())) { oos.writeObject(task); } catch (IOException ex) { LOGGER.log(Level.SEVERE, "Could not save file {0} with the exception {1}", new Object[]{targetFile, ex}); } }
public static void createFile(FileObject target, String content, String encoding) throws IOException{ FileLock lock = target.lock(); try { BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(target.getOutputStream(lock), encoding)); bw.write(content); bw.close(); } finally { lock.releaseLock(); } }
protected void save(Entity object, FileObject fileObject) { LOGGER.log(Level.FINEST, "saving {0} object to file {1}", new Object[]{object.getItemIdType(), fileObject.getName()}); // Try-with-resource seems to have slower performance try (ObjectOutputStream oos = new ObjectOutputStream(fileObject.getOutputStream())) { oos.writeObject(object); } catch (IOException ex) { LOGGER.log(Level.SEVERE, "Could not save file {0} with the exception {1}", new Object[]{fileObject, ex}); } }
protected void save(Entity object, FileObject fileObject) { LOGGER.log(Level.FINEST, "saving {0} object to file {1}", new Object[]{object.getItemIdType(), fileObject.getName()}); // Try-with-resource seems to have slower performance try (ObjectOutputStream oos = new ObjectOutputStream(fileObject.getOutputStream())) { oos.writeObject(object); } catch (IOException ex) { LOGGER.log(Level.SEVERE, "Could not save file {0} with the exception {1}", new Object[]{fileObject, ex}); } }
private static void storeEditableProperties(final EditableProperties p, final File bundle) throws IOException { FileObject fo = FileUtil.toFileObject(bundle); OutputStream os = null == fo ? new FileOutputStream(bundle) : fo.getOutputStream(); try { p.store(os); } finally { os.close(); } }
public LckStream (final FileObject fo) throws IOException { assert fo != null; this.lock = fo.lock(); try { this.delegate = fo.getOutputStream (this.lock); } finally { if (this.delegate == null) { this.lock.releaseLock(); } } }