/** * Get an OutputStream for the Resource. * @return an OutputStream to which content can be written. * @throws IOException if unable to provide the content of this * Resource as a stream. * @throws UnsupportedOperationException if OutputStreams are not * supported for this Resource type. */ @Override public OutputStream getOutputStream() throws IOException { return getResource().getOutputStream(); }
/** * Get an OutputStream for the Resource. * @return an OutputStream to which content can be written. * @throws IOException if unable to provide the content of this * Resource as a stream. * @throws UnsupportedOperationException if OutputStreams are not * supported for this Resource type. * @since Ant 1.7 */ public OutputStream getOutputStream() throws IOException { if (isReference()) { return getCheckedRef().getOutputStream(); } throw new UnsupportedOperationException(); }
/** * Get an OutputStream for the Resource. * @return an OutputStream to which content can be written. * @throws IOException if unable to provide the content of this * Resource as a stream. * @throws UnsupportedOperationException if OutputStreams are not * supported for this Resource type. */ @Override public OutputStream getOutputStream() throws IOException { OutputStream out = getResource().getOutputStream(); if (out != null) { out = wrapStream(out); } return out; }
private static OutputStream getOutputStream(final Resource resource, final boolean append, final Project project) throws IOException { if (append) { final Appendable a = resource.as(Appendable.class); if (a != null) { return a.getAppendOutputStream(); } String msg = "Appendable OutputStream not available for non-appendable resource " + resource + "; using plain OutputStream"; if (project != null) { project.log(msg, Project.MSG_VERBOSE); } else { System.out.println(msg); } } return resource.getOutputStream(); }
/** * Get an OutputStream for the Resource. * @return an OutputStream to which content can be written. * @throws IOException if unable to provide the content of this * Resource as a stream. * @throws UnsupportedOperationException if OutputStreams are not * supported for this Resource type. * @throws IOException if the URL cannot be opened. */ public synchronized OutputStream getOutputStream() throws IOException { if (isReference()) { return getCheckedRef().getOutputStream(); } connect(); try { return conn.getOutputStream(); } finally { conn = null; } }
/** * Get an OutputStream for the Resource. * @return an OutputStream to which content can be written. * @throws IOException if unable to provide the content of this * Resource as a stream. * @throws UnsupportedOperationException if OutputStreams are not * supported for this Resource type. */ @Override public OutputStream getOutputStream() throws IOException { if (isReferenceOrProxy()) { return getReferencedOrProxied().getOutputStream(); } if (isExists()) { throw new ImmutableResourceException(); } return new PropertyOutputStream(getProject(), getName()); }
os = output.getOutputStream(); if (append) { log("Ignoring append=true for non-appendable"
@Override public void readAll(Reader in) throws IOException { IoUtil.copy(in, this.resource.getOutputStream(), Charset.defaultCharset()); } }
/** * Set the path to the file where profile information should be written to, or {@code -} for stdout. * * @param profileFile the path to the file where profile information should be written to, or {@code -} for stdout */ public void setProfileFile(Resource profileFile) { try { userArgs.setProfile(profileFile.getOutputStream()); } catch (Exception e) { handleError(e); } }
/** * Set the path to the file where profile information should be written to, or {@code -} for stdout. * * @param profileFile the path to the file where profile information should be written to, or {@code -} for stdout */ public void setProfileFile(Resource profileFile) { try { userArgs.setProfile(profileFile.getOutputStream()); } catch (Exception e) { handleError(e); } }
/** * Get an OutputStream for the Resource. * @return an OutputStream to which content can be written. * @throws IOException if unable to provide the content of this * Resource as a stream. * @throws UnsupportedOperationException if OutputStreams are not * supported for this Resource type. */ @Override public OutputStream getOutputStream() throws IOException { if (isReference()) { return ((Resource) getCheckedRef()).getOutputStream(); } throw new UnsupportedOperationException("Use the " + archiveType + " task for " + archiveType + " output."); }
/** * packs a resource to an output stream * @throws IOException on error */ private void pack() { InputStream in = null; OutputStream out = null; try { in = src.getInputStream(); out = StreamHelper.getOutputStream(factory, dest); if (out == null) { out = factory.getCompressorStream(new BufferedOutputStream(dest.getOutputStream())); } IOUtils.copy(in, out, BUFFER_SIZE); } catch (IOException e) { throw new BuildException("Error compressing " + src.getName() + " to " + dest.getName(), e); } finally { FileUtils.close(in); FileUtils.close(out); } }
out = factory.getArchiveStream(new BufferedOutputStream(getDest() .getOutputStream()), enc);
for (Iterator<Resource> iterator = resources.iterator(); iterator.hasNext(); ) { Resource resource = iterator.next(); userArgs.addOutput(port, resource.getOutputStream());
for (Iterator<Resource> iterator = resources.iterator(); iterator.hasNext(); ) { Resource resource = iterator.next(); userArgs.addOutput(port, resource.getOutputStream());