/[classpath]/classpath/java/util/zip/ZipOutputStream.java
ViewVC logotype

Diff of /classpath/java/util/zip/ZipOutputStream.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mark, Tue Jan 22 22:27:02 2002 UTC revision 1.5 by jewel, Thu May 30 18:50:40 2002 UTC
# Line 94  public class ZipOutputStream extends Def Line 94  public class ZipOutputStream extends Def
94    /**    /**
95     * Set the zip file comment.     * Set the zip file comment.
96     * @param comment the comment.     * @param comment the comment.
97     * @exception IllegalArgumentException if UTF8 encoding of comment is     * @exception IllegalArgumentException if encoding of comment is
98     * longer than 0xffff bytes.     * longer than 0xffff bytes.
99     */     */
100    public void setComment(String comment)    public void setComment(String comment)
101    {    {
102      byte[] commentBytes;      byte[] commentBytes;
103      try      commentBytes = comment.getBytes();
       {  
         commentBytes = comment.getBytes("UTF8");  
       }  
     catch (UnsupportedEncodingException ex)  
       {  
         throw new InternalError("UTF8 encoding not found");  
       }  
104      if (commentBytes.length > 0xffff)      if (commentBytes.length > 0xffff)
105        throw new IllegalArgumentException("Comment too long.");        throw new IllegalArgumentException("Comment too long.");
106      zipComment = commentBytes;      zipComment = commentBytes;
# Line 231  public class ZipOutputStream extends Def Line 224  public class ZipOutputStream extends Def
224          writeLeInt(0);          writeLeInt(0);
225          writeLeInt(0);          writeLeInt(0);
226        }        }
227      byte[] name = entry.getName().getBytes("UTF8");      byte[] name = entry.getName().getBytes();
228      if (name.length > 0xffff)      if (name.length > 0xffff)
229        throw new ZipException("Name too long.");        throw new ZipException("Name too long.");
230      byte[] extra = entry.getExtra();      byte[] extra = entry.getExtra();
# Line 362  public class ZipOutputStream extends Def Line 355  public class ZipOutputStream extends Def
355          writeLeInt((int)entry.getCompressedSize());          writeLeInt((int)entry.getCompressedSize());
356          writeLeInt((int)entry.getSize());          writeLeInt((int)entry.getSize());
357    
358          byte[] name = entry.getName().getBytes("UTF8");          byte[] name = entry.getName().getBytes();
359          if (name.length > 0xffff)          if (name.length > 0xffff)
360            throw new ZipException("Name too long.");            throw new ZipException("Name too long.");
361          byte[] extra = entry.getExtra();          byte[] extra = entry.getExtra();
# Line 370  public class ZipOutputStream extends Def Line 363  public class ZipOutputStream extends Def
363            extra = new byte[0];            extra = new byte[0];
364          String strComment = entry.getComment();          String strComment = entry.getComment();
365          byte[] comment = strComment != null          byte[] comment = strComment != null
366            ? strComment.getBytes("UTF8") : new byte[0];            ? strComment.getBytes() : new byte[0];
367          if (comment.length > 0xffff)          if (comment.length > 0xffff)
368            throw new ZipException("Comment too long.");            throw new ZipException("Comment too long.");
369    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26