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

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

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

revision 1.12.2.3 by gnu_andrew, Tue Aug 2 20:12:35 2005 UTC revision 1.12.2.4 by gnu_andrew, Sat Sep 10 15:31:47 2005 UTC
# Line 39  exception statement from your version. * Line 39  exception statement from your version. *
39  package java.util.zip;  package java.util.zip;
40    
41  import java.util.Calendar;  import java.util.Calendar;
 import java.util.Date;  
42    
43  /**  /**
44   * This class represents a member of a zip archive.  ZipFile and   * This class represents a member of a zip archive.  ZipFile and
# Line 173  public class ZipEntry implements ZipCons Line 172  public class ZipEntry implements ZipCons
172      Calendar cal = getCalendar();      Calendar cal = getCalendar();
173      synchronized (cal)      synchronized (cal)
174        {        {
175          cal.setTime(new Date(time));          cal.setTimeInMillis(time);
176          dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25          dostime = (cal.get(Calendar.YEAR) - 1980 & 0x7f) << 25
177            | (cal.get(Calendar.MONTH) + 1) << 21            | (cal.get(Calendar.MONTH) + 1) << 21
178            | (cal.get(Calendar.DAY_OF_MONTH)) << 16            | (cal.get(Calendar.DAY_OF_MONTH)) << 16
# Line 190  public class ZipEntry implements ZipCons Line 189  public class ZipEntry implements ZipCons
189     */     */
190    public long getTime()    public long getTime()
191    {    {
192        // The extra bytes might contain the time (posix/unix extension)
193        parseExtra();
194    
195      if ((known & KNOWN_TIME) == 0)      if ((known & KNOWN_TIME) == 0)
196        return -1;        return -1;
197    
     // The extra bytes might contain the time (posix/unix extension)  
     parseExtra ();  
   
198      int sec = 2 * (dostime & 0x1f);      int sec = 2 * (dostime & 0x1f);
199      int min = (dostime >> 5) & 0x3f;      int min = (dostime >> 5) & 0x3f;
200      int hrs = (dostime >> 11) & 0x1f;      int hrs = (dostime >> 11) & 0x1f;
# Line 209  public class ZipEntry implements ZipCons Line 208  public class ZipEntry implements ZipCons
208          synchronized (cal)          synchronized (cal)
209            {            {
210              cal.set(year, mon, day, hrs, min, sec);              cal.set(year, mon, day, hrs, min, sec);
211              return cal.getTime().getTime();              return cal.getTimeInMillis();
212            }            }
213        }        }
214      catch (RuntimeException ex)      catch (RuntimeException ex)
# Line 367  public class ZipEntry implements ZipCons Line 366  public class ZipEntry implements ZipCons
366      catch (ArrayIndexOutOfBoundsException ex)      catch (ArrayIndexOutOfBoundsException ex)
367        {        {
368          /* be lenient */          /* be lenient */
         return;  
369        }        }
370    
371      known |= KNOWN_EXTRA;      known |= KNOWN_EXTRA;
372        return;
373    }    }
374    
375    /**    /**

Legend:
Removed from v.1.12.2.3  
changed lines
  Added in v.1.12.2.4

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