Java Code Examples for java.util.jar.JarEntry#getMethod()
The following examples show how to use
java.util.jar.JarEntry#getMethod() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackerImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = (int) je.getTimeLocal() .atOffset(ZoneOffset.UTC) .toEpochSecond(); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 2
Source File: PackerImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 3
Source File: PackerImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 4
Source File: PackerImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 5
Source File: PackerImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 6
Source File: PackerImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 7
Source File: PackerImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 8
Source File: PackerImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 9
Source File: PackerImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 10
Source File: ZipSigner.java From BusyBox with Apache License 2.0 | 5 votes |
/** Copy all the files in a manifest from input to output. */ private static void copyFiles(Manifest manifest, JarFile in, JarArchiveOutputStream out, long timestamp) throws IOException { final byte[] buffer = new byte[4096]; int num; final Map<String, Attributes> entries = manifest.getEntries(); final List<String> names = new ArrayList<>(entries.keySet()); Collections.sort(names); for (final String name : names) { final JarEntry inEntry = in.getJarEntry(name); if (inEntry.getMethod() == JarArchiveEntry.STORED) { // Preserve the STORED method of the input entry. out.putArchiveEntry(new JarArchiveEntry(inEntry)); } else { // Create a new entry so that the compressed len is recomputed. final JarArchiveEntry je = new JarArchiveEntry(name); je.setTime(timestamp); out.putArchiveEntry(je); } final InputStream data = in.getInputStream(inEntry); while ((num = data.read(buffer)) > 0) { out.write(buffer, 0, num); } out.flush(); out.closeArchiveEntry(); } }
Example 11
Source File: PackerImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 12
Source File: PackerImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 13
Source File: PackerImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 14
Source File: PackerImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
InFile(JarFile jf, JarEntry je) { this.name = Utils.getJarEntryName(je.getName()); this.f = null; this.jf = jf; this.je = je; int timeSecs = getModtime(je.getTime()); if (keepModtime && timeSecs != Constants.NO_MODTIME) { this.modtime = timeSecs; } else if (latestModtime && timeSecs > pkg.default_modtime) { pkg.default_modtime = timeSecs; } if (keepDeflateHint && je.getMethod() == JarEntry.DEFLATED) { options |= Constants.FO_DEFLATE_HINT; } }
Example 15
Source File: JarStreamingAssembly.java From portals-pluto with Apache License 2.0 | 5 votes |
private static JarEntry smartClone(JarEntry originalJarEntry) { final JarEntry newJarEntry = new JarEntry(originalJarEntry.getName()); newJarEntry.setComment(originalJarEntry.getComment()); newJarEntry.setExtra(originalJarEntry.getExtra()); newJarEntry.setMethod(originalJarEntry.getMethod()); newJarEntry.setTime(originalJarEntry.getTime()); //Must set size and CRC for STORED entries if (newJarEntry.getMethod() == ZipEntry.STORED) { newJarEntry.setSize(originalJarEntry.getSize()); newJarEntry.setCrc(originalJarEntry.getCrc()); } return newJarEntry; }
Example 16
Source File: ExamineArchiveTask.java From portals-pluto with Apache License 2.0 | 5 votes |
public void execute() throws BuildException { try { JarInputStream jarIn = new JarInputStream( new FileInputStream( archive ) ); JarEntry entry; while ( ( entry = jarIn.getNextJarEntry() ) != null ) { String name = entry.getName(); long crc = entry.getCrc(); long size = entry.getSize(); long compressedSize = entry.getCompressedSize(); int compressMethod = entry.getMethod(); long timeStamp = entry.getTime(); int hashCode = entry.hashCode(); StringBuffer out = new StringBuffer(); out.append( "Name: " + name + "\n" ); out.append( " Size: " + Long.toHexString( size ) + " " ); out.append( " Compressed Size: " + Long.toHexString( compressedSize ) + " " ); out.append( " Compression Method: " + compressMethod + " " ); out.append( " Timestamp: " + Long.toHexString( timeStamp ) + " " ); out.append( " HashCode: " + Integer.toHexString( hashCode ) + " " ); out.append( " CRC: " + Long.toHexString( crc ) + " " ); System.out.println( out.toString() ); } } catch ( Exception e ) { throw new BuildException( e.getMessage(), e ); } }