"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "subprojects/groovy-nio/src/main/java/org/apache/groovy/nio/extensions/NioExtensions.java" between
apache-groovy-src-3.0.8.zip and apache-groovy-src-3.0.9.zip

About: Groovy is an agile dynamic (scripting) language for the Java Platform. It has features similar to those of Python, Ruby, Perl, and Smalltalk. Source release.

NioExtensions.java  (apache-groovy-src-3.0.8):NioExtensions.java  (apache-groovy-src-3.0.9)
skipping to change at line 1639 skipping to change at line 1639
* Creates a new BufferedWriter for this file, passes it to the closure, and * Creates a new BufferedWriter for this file, passes it to the closure, and
* ensures the stream is flushed and closed after the closure returns. * ensures the stream is flushed and closed after the closure returns.
* The writer will not write a BOM. * The writer will not write a BOM.
* *
* @param self a Path * @param self a Path
* @param closure a closure * @param closure a closure
* @return the value returned by the closure * @return the value returned by the closure
* @throws java.io.IOException if an IOException occurs. * @throws java.io.IOException if an IOException occurs.
* @since 2.3.0 * @since 2.3.0
*/ */
public static <T> T withWriter(Path self, @ClosureParams(value = SimpleType. class, options = "java.io.Writer") Closure<T> closure) throws IOException { public static <T> T withWriter(Path self, @ClosureParams(value = SimpleType. class, options = "java.io.BufferedWriter") Closure<T> closure) throws IOExceptio n {
return withWriter(self, Charset.defaultCharset().name(), closure); return withWriter(self, Charset.defaultCharset().name(), closure);
} }
/** /**
* Creates a new BufferedWriter for this file, passes it to the closure, and * Creates a new BufferedWriter for this file, passes it to the closure, and
* ensures the stream is flushed and closed after the closure returns. * ensures the stream is flushed and closed after the closure returns.
* The writer will use the given charset encoding, but will not write a BOM. * The writer will use the given charset encoding, but will not write a BOM.
* *
* @param self a Path * @param self a Path
* @param charset the charset used * @param charset the charset used
* @param closure a closure * @param closure a closure
* @return the value returned by the closure * @return the value returned by the closure
* @throws java.io.IOException if an IOException occurs. * @throws java.io.IOException if an IOException occurs.
* @since 2.3.0 * @since 2.3.0
*/ */
public static <T> T withWriter(Path self, String charset, @ClosureParams(val ue = SimpleType.class, options = "java.io.Writer") Closure<T> closure) throws IO Exception { public static <T> T withWriter(Path self, String charset, @ClosureParams(val ue = SimpleType.class, options = "java.io.BufferedWriter") Closure<T> closure) t hrows IOException {
return withWriter(self, charset, false, closure); return withWriter(self, charset, false, closure);
} }
/** /**
* Creates a new BufferedWriter for this file, passes it to the closure, and * Creates a new BufferedWriter for this file, passes it to the closure, and
* ensures the stream is flushed and closed after the closure returns. * ensures the stream is flushed and closed after the closure returns.
* The writer will use the given charset encoding. If the given charset is * The writer will use the given charset encoding. If the given charset is
* "UTF-16BE" or "UTF-16LE" (or an equivalent alias), <code>writeBom</code> * "UTF-16BE" or "UTF-16LE" (or an equivalent alias), <code>writeBom</code>
* is <code>true</code>, and the file doesn't already exist, the requisite * is <code>true</code>, and the file doesn't already exist, the requisite
* byte order mark is written to the stream when the writer is created. * byte order mark is written to the stream when the writer is created.
* *
* @param self a Path * @param self a Path
* @param charset the charset used * @param charset the charset used
* @param writeBom whether to write the BOM * @param writeBom whether to write the BOM
* @param closure a closure * @param closure a closure
* @return the value returned by the closure * @return the value returned by the closure
* @throws java.io.IOException if an IOException occurs. * @throws java.io.IOException if an IOException occurs.
* @since 2.5.0 * @since 2.5.0
*/ */
public static <T> T withWriter(Path self, String charset, boolean writeBom, @ClosureParams(value = SimpleType.class, options = "java.io.Writer") Closure<T> closure) throws IOException { public static <T> T withWriter(Path self, String charset, boolean writeBom, @ClosureParams(value = SimpleType.class, options = "java.io.BufferedWriter") Clo sure<T> closure) throws IOException {
return IOGroovyMethods.withWriter(newWriter(self, charset, false, writeB om), closure); return IOGroovyMethods.withWriter(newWriter(self, charset, false, writeB om), closure);
} }
/** /**
* Create a new BufferedWriter which will append to this * Create a new BufferedWriter which will append to this
* file. The writer is passed to the closure and will be closed before * file. The writer is passed to the closure and will be closed before
* this method returns. The writer will use the given charset encoding, * this method returns. The writer will use the given charset encoding,
* but will not write a BOM. * but will not write a BOM.
* *
* @param self a Path * @param self a Path
* @param charset the charset used * @param charset the charset used
* @param closure a closure * @param closure a closure
* @return the value returned by the closure * @return the value returned by the closure
* @throws java.io.IOException if an IOException occurs. * @throws java.io.IOException if an IOException occurs.
* @since 2.3.0 * @since 2.3.0
*/ */
public static <T> T withWriterAppend(Path self, String charset, @ClosurePara ms(value = SimpleType.class, options = "java.io.Writer") Closure<T> closure) thr ows IOException { public static <T> T withWriterAppend(Path self, String charset, @ClosurePara ms(value = SimpleType.class, options = "java.io.BufferedWriter") Closure<T> clos ure) throws IOException {
return withWriterAppend(self, charset, false, closure); return withWriterAppend(self, charset, false, closure);
} }
/** /**
* Create a new BufferedWriter which will append to this * Create a new BufferedWriter which will append to this
* file. The writer is passed to the closure and will be closed before * file. The writer is passed to the closure and will be closed before
* this method returns. The writer will use the given charset encoding. * this method returns. The writer will use the given charset encoding.
* If the given charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias) , * If the given charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias) ,
* <code>writeBom</code> is <code>true</code>, and the file doesn't already exist, * <code>writeBom</code> is <code>true</code>, and the file doesn't already exist,
* the requisite byte order mark is written to the stream when the writer is created. * the requisite byte order mark is written to the stream when the writer is created.
* *
* @param self a Path * @param self a Path
* @param charset the charset used * @param charset the charset used
* @param writeBom whether to write the BOM * @param writeBom whether to write the BOM
* @param closure a closure * @param closure a closure
* @return the value returned by the closure * @return the value returned by the closure
* @throws java.io.IOException if an IOException occurs. * @throws java.io.IOException if an IOException occurs.
* @since 2.5.0 * @since 2.5.0
*/ */
public static <T> T withWriterAppend(Path self, String charset, boolean writ eBom, @ClosureParams(value = SimpleType.class, options = "java.io.Writer") Closu re<T> closure) throws IOException { public static <T> T withWriterAppend(Path self, String charset, boolean writ eBom, @ClosureParams(value = SimpleType.class, options = "java.io.BufferedWriter ") Closure<T> closure) throws IOException {
return IOGroovyMethods.withWriter(newWriter(self, charset, true, writeBo m), closure); return IOGroovyMethods.withWriter(newWriter(self, charset, true, writeBo m), closure);
} }
/** /**
* Create a new BufferedWriter for this file in append mode. The writer * Create a new BufferedWriter for this file in append mode. The writer
* is passed to the closure and is closed after the closure returns. * is passed to the closure and is closed after the closure returns.
* The writer will not write a BOM. * The writer will not write a BOM.
* *
* @param self a Path * @param self a Path
* @param closure a closure * @param closure a closure
* @return the value returned by the closure * @return the value returned by the closure
* @throws java.io.IOException if an IOException occurs. * @throws java.io.IOException if an IOException occurs.
* @since 2.3.0 * @since 2.3.0
*/ */
public static <T> T withWriterAppend(Path self, @ClosureParams(value = Simpl eType.class, options = "java.io.Writer") Closure<T> closure) throws IOException { public static <T> T withWriterAppend(Path self, @ClosureParams(value = Simpl eType.class, options = "java.io.BufferedWriter") Closure<T> closure) throws IOEx ception {
return withWriterAppend(self, Charset.defaultCharset().name(), closure); return withWriterAppend(self, Charset.defaultCharset().name(), closure);
} }
/** /**
* Create a new PrintWriter for this file. * Create a new PrintWriter for this file.
* *
* @param self a Path * @param self a Path
* @return the created PrintWriter * @return the created PrintWriter
* @throws java.io.IOException if an IOException occurs. * @throws java.io.IOException if an IOException occurs.
* @since 2.3.0 * @since 2.3.0
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)