Return-Path: X-Original-To: apmail-groovy-notifications-archive@minotaur.apache.org Delivered-To: apmail-groovy-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 515BA1875F for ; Tue, 9 Jun 2015 17:19:40 +0000 (UTC) Received: (qmail 70104 invoked by uid 500); 9 Jun 2015 17:19:40 -0000 Delivered-To: apmail-groovy-notifications-archive@groovy.apache.org Received: (qmail 70080 invoked by uid 500); 9 Jun 2015 17:19:40 -0000 Mailing-List: contact notifications-help@groovy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.incubator.apache.org Delivered-To: mailing list notifications@groovy.incubator.apache.org Received: (qmail 70071 invoked by uid 99); 9 Jun 2015 17:19:40 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Jun 2015 17:19:40 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id BF784CCC8C for ; Tue, 9 Jun 2015 17:19:39 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.77 X-Spam-Level: * X-Spam-Status: No, score=1.77 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 0t5qGKtkewlC for ; Tue, 9 Jun 2015 17:19:39 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id 97FF427637 for ; Tue, 9 Jun 2015 17:19:37 +0000 (UTC) Received: (qmail 70027 invoked by uid 99); 9 Jun 2015 17:19:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Jun 2015 17:19:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 639E4E00E0; Tue, 9 Jun 2015 17:19:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pascalschumacher@apache.org To: notifications@groovy.incubator.apache.org Date: Tue, 09 Jun 2015 17:19:38 -0000 Message-Id: <5d66c62cfada46dabb00e29e3c4597ce@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/2] incubator-groovy git commit: document UTF-16 BOM writing (closes #37) document UTF-16 BOM writing (closes #37) Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/50e9bad5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/50e9bad5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/50e9bad5 Branch: refs/heads/GROOVY_2_4_X Commit: 50e9bad55f96ca181391bfff8caaad4b33216817 Parents: 68136a8 Author: Keegan Witt Authored: Tue Jun 9 12:40:20 2015 -0400 Committer: pascalschumacher Committed: Tue Jun 9 19:19:18 2015 +0200 ---------------------------------------------------------------------- .../groovy/runtime/ResourceGroovyMethods.java | 38 ++++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/50e9bad5/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java ---------------------------------------------------------------------- diff --git a/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java index 5b2bcac..7740075 100644 --- a/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java +++ b/src/main/org/codehaus/groovy/runtime/ResourceGroovyMethods.java @@ -827,7 +827,9 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport { } /** - * Write the text to the File, using the specified encoding. + * Write the text to the File, using the specified encoding. If the given + * charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias), the + * requisite byte order mark is written to the file before the text. * * @param file a File * @param text the text to write to the File @@ -956,7 +958,10 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport { } /** - * Append the text at the end of the File, using a specified encoding. + * Append the text at the end of the File, using a specified encoding. If + * the given charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias) + * and the file doesn't already exist, the requisite byte order mark is + * written to the file before the text is appended. * * @param file a File * @param text the text to append at the end of the File @@ -1742,8 +1747,9 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport { /** * Helper method to create a buffered writer for a file. If the given - * charset is "UTF-16BE" or "UTF-16LE", the requisite byte order mark is - * written to the stream before the writer is returned. + * charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias), the + * requisite byte order mark is written to the stream before the writer + * is returned. * * @param file a File * @param charset the name of the encoding used to write in this file @@ -1773,7 +1779,9 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport { /** * Creates a buffered writer for this file, writing data using the given - * encoding. + * encoding. If the given charset is "UTF-16BE" or "UTF-16LE" (or an + * equivalent alias), the requisite byte order mark is written to the + * stream before the writer is returned. * * @param file a File * @param charset the name of the encoding used to write in this file @@ -1820,7 +1828,9 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport { /** * Creates a new BufferedWriter for this file, passes it to the closure, and * ensures the stream is flushed and closed after the closure returns. - * The writer will use the given charset encoding. + * The writer will use the given charset encoding. If the given charset is + * "UTF-16BE" or "UTF-16LE" (or an equivalent alias), the requisite byte + * order mark is written to the stream when the writer is created. * * @param file a File * @param charset the charset used @@ -1834,8 +1844,10 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport { } /** - * Create a new BufferedWriter which will append to this - * file. The writer is passed to the closure and will be closed before + * Create a new BufferedWriter which will append to this file. If the + * given charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias), the + * requisite byte order mark is written to the stream when the writer is + * created. The writer is passed to the closure and will be closed before * this method returns. * * @param file a File @@ -1877,7 +1889,9 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport { /** * Create a new PrintWriter for this file, using specified - * charset. + * charset. If the given charset is "UTF-16BE" or "UTF-16LE" (or an + * equivalent alias), the requisite byte order mark is written to the + * stream before the writer is returned. * * @param file a File * @param charset the charset @@ -1905,8 +1919,10 @@ public class ResourceGroovyMethods extends DefaultGroovyMethodsSupport { } /** - * Create a new PrintWriter with a specified charset for - * this file. The writer is passed to the closure, and will be closed + * Create a new PrintWriter with a specified charset for this file. If the + * given charset is "UTF-16BE" or "UTF-16LE" (or an equivalent alias), the + * requisite byte order mark is written to the stream when the writer is + * created. The writer is passed to the closure, and will be closed * before this method returns. * * @param file a File