Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 30695 invoked from network); 23 Apr 2009 05:53:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Apr 2009 05:53:41 -0000 Received: (qmail 72499 invoked by uid 500); 23 Apr 2009 05:53:40 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 72395 invoked by uid 500); 23 Apr 2009 05:53:39 -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 72386 invoked by uid 99); 23 Apr 2009 05:53:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Apr 2009 05:53:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Thu, 23 Apr 2009 05:53:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C05582388ACF; Thu, 23 Apr 2009 05:53:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r767810 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java Date: Thu, 23 Apr 2009 05:53:16 -0000 To: commits@commons.apache.org From: grobmeier@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090423055316.C05582388ACF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: grobmeier Date: Thu Apr 23 05:53:16 2009 New Revision: 767810 URL: http://svn.apache.org/viewvc?rev=767810&view=rev Log: COMPRESS-63: fields are stored in ASCII added javadoc Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java?rev=767810&r1=767809&r2=767810&view=diff ============================================================================== --- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java (original) +++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java Thu Apr 23 05:53:16 2009 @@ -372,14 +372,24 @@ } else { tmpStr = tmp.substring(tmp.length() - length); } - out.write(tmpStr.getBytes()); // TODO is it correct to use the default charset here? + out.write(ArchiveUtils.toAsciiBytes(tmpStr)); } + /** + * Writes an ASCII string to the stream followed by \0 + * @param str the String to write + * @throws IOException if the string couldn't be written + */ private void writeCString(final String str) throws IOException { - out.write(str.getBytes()); // TODO is it correct to use the default charset here? + out.write(ArchiveUtils.toAsciiBytes(str)); out.write('\0'); } + /** + * Creates a new ArchiveEntry. The entryName must be an ASCII encoded string. + * + * @see org.apache.commons.compress.archivers.ArchiveOutputStream#createArchiveEntry(java.io.File, java.lang.String) + */ public ArchiveEntry createArchiveEntry(File inputFile, String entryName) throws IOException { return new CpioArchiveEntry(inputFile, entryName);