822 m.write(os); 823 os.updateEntry(e); 824 } 825 826 /** 827 * Computes the crc32 of a File. This is necessary when the 828 * ZipOutputStream is in STORED mode. 829 */ 830 private void crc32File(ZipEntry e, File f) throws IOException { 831 CRC32OutputStream os = new CRC32OutputStream(); 832 copy(f, os); 833 if (os.n != f.length()) { 834 throw new JarException(formatMsg( 835 "error.incorrect.length", f.getPath())); 836 } 837 os.updateEntry(e); 838 } 839 840 void replaceFSC(String files[]) { 841 if (files != null) { 842 for (String file : files) { 843 file = file.replace(File.separatorChar, '/'); 844 } 845 } 846 } 847 848 @SuppressWarnings("serial") 849 Set<ZipEntry> newDirSet() { 850 return new HashSet<ZipEntry>() { 851 public boolean add(ZipEntry e) { 852 return ((e == null || useExtractionTime) ? false : super.add(e)); 853 }}; 854 } 855 856 void updateLastModifiedTime(Set<ZipEntry> zes) throws IOException { 857 for (ZipEntry ze : zes) { 858 long lastModified = ze.getTime(); 859 if (lastModified != -1) { 860 File f = new File(ze.getName().replace('/', File.separatorChar)); 861 f.setLastModified(lastModified); 862 } 863 } | 822 m.write(os); 823 os.updateEntry(e); 824 } 825 826 /** 827 * Computes the crc32 of a File. This is necessary when the 828 * ZipOutputStream is in STORED mode. 829 */ 830 private void crc32File(ZipEntry e, File f) throws IOException { 831 CRC32OutputStream os = new CRC32OutputStream(); 832 copy(f, os); 833 if (os.n != f.length()) { 834 throw new JarException(formatMsg( 835 "error.incorrect.length", f.getPath())); 836 } 837 os.updateEntry(e); 838 } 839 840 void replaceFSC(String files[]) { 841 if (files != null) { 842 for (int i = 0; i < files.length; i++) { 843 files[i] = files[i].replace(File.separatorChar, '/'); 844 } 845 } 846 } 847 848 @SuppressWarnings("serial") 849 Set<ZipEntry> newDirSet() { 850 return new HashSet<ZipEntry>() { 851 public boolean add(ZipEntry e) { 852 return ((e == null || useExtractionTime) ? false : super.add(e)); 853 }}; 854 } 855 856 void updateLastModifiedTime(Set<ZipEntry> zes) throws IOException { 857 for (ZipEntry ze : zes) { 858 long lastModified = ze.getTime(); 859 if (lastModified != -1) { 860 File f = new File(ze.getName().replace('/', File.separatorChar)); 861 f.setLastModified(lastModified); 862 } 863 } |