/** * Enforce String immutability. * @param s the new name/value for this StringResource. */ @Override public synchronized void setName(String s) { if (getName() != null) { throw new BuildException(new ImmutableResourceException()); } super.setName(s); }
/** * 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 synchronized OutputStream getOutputStream() throws IOException { if (isReference()) { return getCheckedRef().getOutputStream(); } if (getValue() != null) { throw new ImmutableResourceException(); } return new StringResourceFilterOutputStream(); }
/** * 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()); }
@Override public OutputStream getOutputStream() throws IOException { throw new ImmutableResourceException(); } }
@Override public OutputStream getOutputStream() throws IOException { throw new ImmutableResourceException(); } }
/** * The value of the resource. */ @Override public void setValue(@Nullable String value) { if (this.getValue() != null) throw new BuildException(new ImmutableResourceException()); this.value = value; }