You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gr...@apache.org on 2009/04/23 07:53:16 UTC

svn commit: r767810 - /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java

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);