/** * Synonym for write(text, charset) allowing: * <pre> * myFile.setText('some text', charset) * </pre> * or with some help from <code>ExpandoMetaClass</code>, you could do something like: * <pre> * myFile.metaClass.setText = { String s -> delegate.setText(s, 'UTF-8') } * myfile.text = 'some text' * </pre> * * @param self A Path * @param charset The charset used when writing to the file * @param text The text to write to the Path * @throws java.io.IOException if an IOException occurs. * @see #write(Path, String, String) * @since 2.3.0 */ public static void setText(Path self, String text, String charset) throws IOException { write(self, text, charset); }
/** * Write the text to the Path without writing a BOM . * * @param self a Path * @param text the text to write to the Path * @throws java.io.IOException if an IOException occurs. * @since 2.3.0 */ public static void write(Path self, String text) throws IOException { write(self, text, false); }
/** * Synonym for write(text) allowing file.text = 'foo'. * * @param self a Path * @param text the text to write to the Path * @throws java.io.IOException if an IOException occurs. * @see #write(Path, String) * @since 2.3.0 */ public static void setText(Path self, String text) throws IOException { write(self, text); }
/** * Write the text to the Path without writing a BOM, using the specified encoding. * * @param self a Path * @param text the text to write to the Path * @param charset the charset used * @throws java.io.IOException if an IOException occurs. * @since 2.3.0 */ public static void write(Path self, String text, String charset) throws IOException { write(self, text, charset, false); }
/** * Synonym for write(text, charset) allowing: * <pre> * myFile.setText('some text', charset) * </pre> * or with some help from <code>ExpandoMetaClass</code>, you could do something like: * <pre> * myFile.metaClass.setText = { String s -> delegate.setText(s, 'UTF-8') } * myfile.text = 'some text' * </pre> * * @param self A Path * @param charset The charset used when writing to the file * @param text The text to write to the Path * @throws java.io.IOException if an IOException occurs. * @see #write(Path, String, String) * @since 2.3.0 */ public static void setText(Path self, String text, String charset) throws IOException { write(self, text, charset); }
/** * Write the text to the Path. If the default charset is * "UTF-16BE" or "UTF-16LE" (or an equivalent alias) and * <code>writeBom</code> is <code>true</code>, the requisite byte order * mark is written to the file before the text. * * @param self a Path * @param text the text to write to the Path * @param writeBom whether to write the BOM * @throws java.io.IOException if an IOException occurs. * @since 2.5.0 */ public static void write(Path self, String text, boolean writeBom) throws IOException { write(self, text, Charset.defaultCharset().name(), writeBom); }