/[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.8.2.2 by gnu_andrew, Tue Aug 2 20:12:35 2005 UTC revision 1.8.2.3 by gnu_andrew, Sat Sep 10 15:31:48 2005 UTC
# Line 1  Line 1 
1  /* ZipOutputStream.java --  /* ZipOutputStream.java --
2     Copyright (C) 2001, 2004  Free Software Foundation, Inc.     Copyright (C) 2001, 2004, 2005  Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 40  package java.util.zip; Line 40  package java.util.zip;
40    
41  import java.io.IOException;  import java.io.IOException;
42  import java.io.OutputStream;  import java.io.OutputStream;
43    import java.io.UnsupportedEncodingException;
44  import java.util.Enumeration;  import java.util.Enumeration;
45  import java.util.Vector;  import java.util.Vector;
46    
# Line 102  public class ZipOutputStream extends Def Line 103  public class ZipOutputStream extends Def
103    public void setComment(String comment)    public void setComment(String comment)
104    {    {
105      byte[] commentBytes;      byte[] commentBytes;
106      commentBytes = comment.getBytes();      try
107          {
108            commentBytes = comment.getBytes("UTF-8");
109          }
110        catch (UnsupportedEncodingException uee)
111          {
112            throw new AssertionError(uee);
113          }
114      if (commentBytes.length > 0xffff)      if (commentBytes.length > 0xffff)
115        throw new IllegalArgumentException("Comment too long.");        throw new IllegalArgumentException("Comment too long.");
116      zipComment = commentBytes;      zipComment = commentBytes;
# Line 226  public class ZipOutputStream extends Def Line 234  public class ZipOutputStream extends Def
234          writeLeInt(0);          writeLeInt(0);
235          writeLeInt(0);          writeLeInt(0);
236        }        }
237      byte[] name = entry.getName().getBytes();      byte[] name;
238        try
239          {
240            name = entry.getName().getBytes("UTF-8");
241          }
242        catch (UnsupportedEncodingException uee)
243          {
244            throw new AssertionError(uee);
245          }
246      if (name.length > 0xffff)      if (name.length > 0xffff)
247        throw new ZipException("Name too long.");        throw new ZipException("Name too long.");
248      byte[] extra = entry.getExtra();      byte[] extra = entry.getExtra();
# Line 357  public class ZipOutputStream extends Def Line 373  public class ZipOutputStream extends Def
373          writeLeInt((int)entry.getCompressedSize());          writeLeInt((int)entry.getCompressedSize());
374          writeLeInt((int)entry.getSize());          writeLeInt((int)entry.getSize());
375    
376          byte[] name = entry.getName().getBytes();          byte[] name;
377            try
378              {
379                name = entry.getName().getBytes("UTF-8");
380              }
381            catch (UnsupportedEncodingException uee)
382              {
383                throw new AssertionError(uee);
384              }
385          if (name.length > 0xffff)          if (name.length > 0xffff)
386            throw new ZipException("Name too long.");            throw new ZipException("Name too long.");
387          byte[] extra = entry.getExtra();          byte[] extra = entry.getExtra();
388          if (extra == null)          if (extra == null)
389            extra = new byte[0];            extra = new byte[0];
390          String strComment = entry.getComment();          String str = entry.getComment();
391          byte[] comment = strComment != null          byte[] comment;
392            ? strComment.getBytes() : new byte[0];          try
393              {
394                comment = str != null ? str.getBytes("UTF-8") : new byte[0];
395              }
396            catch (UnsupportedEncodingException uee)
397              {
398                throw new AssertionError(uee);
399              }
400          if (comment.length > 0xffff)          if (comment.length > 0xffff)
401            throw new ZipException("Comment too long.");            throw new ZipException("Comment too long.");
402    

Legend:
Removed from v.1.8.2.2  
changed lines
  Added in v.1.8.2.3

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