Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 27A73F0EE for ; Sat, 20 Apr 2013 18:06:46 +0000 (UTC) Received: (qmail 22701 invoked by uid 500); 20 Apr 2013 18:06:45 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 22618 invoked by uid 500); 20 Apr 2013 18:06:45 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 22610 invoked by uid 99); 20 Apr 2013 18:06:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Apr 2013 18:06:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 20 Apr 2013 18:06:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E3D8F238899C; Sat, 20 Apr 2013 18:06:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1470213 - /commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java Date: Sat, 20 Apr 2013 18:06:24 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130420180624.E3D8F238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebb Date: Sat Apr 20 18:06:24 2013 New Revision: 1470213 URL: http://svn.apache.org/r1470213 Log: Add support for Charset encoding (already supports String) Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java?rev=1470213&r1=1470212&r2=1470213&view=diff ============================================================================== --- commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java (original) +++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java Sat Apr 20 18:06:24 2013 @@ -375,4 +375,17 @@ public class ByteArrayOutputStream exten return new String(toByteArray(), enc); } + /** + * Gets the curent contents of this byte stream as a string + * using the specified encoding. + * + * @param charset the character encoding + * @return the string converted from the byte array + * @see java.io.ByteArrayOutputStream#toString(String) + * @since 2.5 + */ + public String toString(final Charset charset) { + return new String(toByteArray(), charset); + } + }