- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {ScheduledThreadPoolExecutor s =
new ScheduledThreadPoolExecutor(corePoolSize)
ThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
String str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
- Smart code suggestions by Codota
}
/** * Compresses the given directory and all its sub-directories into a ZIP file. * <p> * The ZIP file must not be a directory and its parent directory must exist. * Will not include the root directory name in the archive. * * @param rootDir * root directory. * @param zip * ZIP file that will be created or overwritten. */ public static void pack(File rootDir, File zip) { pack(rootDir, zip, DEFAULT_COMPRESSION_LEVEL); }
/** * Unpacks a ZIP stream to the given directory. * <p> * The output directory must not be a file. * * @param is * inputstream for ZIP file. * @param outputDir * output directory (created automatically if not found). */ public static void unpack(InputStream is, File outputDir) { unpack(is, outputDir, IdentityNameMapper.INSTANCE, null); }
/** * Unpacks a single file from a ZIP archive to a file. * * @param zip * ZIP file. * @param name * entry name. * @param file * target file to be created or overwritten. * @return <code>true</code> if the entry was found and unpacked, * <code>false</code> if the entry was not found. */ public static boolean unpackEntry(File zip, String name, File file) { return unpackEntry(zip, name, file, null); }
final Set<String> dirNames = filterDirEntries(zip, ignoredEntries); iterate(zip, new ZipEntryCallback() { public void process(InputStream in, ZipEntry zipEntry) throws IOException { String entryName = zipEntry.getName();
final Map<String, ZipEntrySource> entryByPath = entriesByPath(entries); try { final ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destZip))); iterate(zip, new ZipEntryCallback() { public void process(InputStream in, ZipEntry zipEntry) throws IOException { if (names.add(zipEntry.getName())) { addEntry(zipEntrySource, out);
final Map<String, ZipEntrySource> entryByPath = entriesByPath(entries); final int entryCount = entryByPath.size(); try { try { final Set<String> names = new HashSet<String>(); iterate(zip, new ZipEntryCallback() { public void process(InputStream in, ZipEntry zipEntry) throws IOException { if (names.add(zipEntry.getName())) {
protected File getZipFile() { final File zipFile = new File(stagingDirectoryPath + ".zip"); final File stagingDirectory = new File(stagingDirectoryPath); ZipUtil.pack(stagingDirectory, zipFile); ZipUtil.removeEntry(zipFile, LOCAL_SETTINGS_FILE); return zipFile; } }
ZipUtil.pack(new File(sdcard + "/iSu_Logs/tmpziplog"), new File(zip_file)); ZipUtil.unpackEntry(new File(zip_file), "logcat.txt", new File(tmplogcat)); if (compareFiles(logcat, tmplogcat, true, mContext)) { Log.d(TAG, "ziped logcat.txt is ok");
/** * See {@link #iterate(InputStream, ZipEntryCallback, Charset)}. This method * is a shorthand for a version where no Charset is specified. * * @param is * input ZIP stream (it will not be closed automatically). * @param action * action to be called for each entry. * * @see ZipEntryCallback * @see #iterate(File, ZipEntryCallback) */ public static void iterate(InputStream is, ZipEntryCallback action) { iterate(is, action, null); }
public P3Package readPackage(File file) throws PackageException { try { if (!ZipUtil.containsEntry(file, "package.json")) { throw new PackageException("No package schema found"); } byte[] schemaBytes = ZipUtil.unpackEntry(file, "package.json"); String schemaString = new String(schemaBytes); JSONObject schema = new JSONObject(schemaString); P3Package p3 = readSchema(schema); p3.setLocalPath(file.getPath()); return p3; } catch(JSONException e) { throw new PackageException("Invalid package schema", e); } }
public boolean act(File tmpFile) { removeEntry(zip, path, tmpFile); return true; } });
@Signature public void remove(Environment env, Memory path) { if (path.isTraversable()) { ForeachIterator iterator = path.getNewIterator(env); List<String> paths = new ArrayList<>(); while (iterator.next()) { String value = iterator.getValue().toString(); paths.add(value); } ZipUtil.removeEntries(zipFile, paths.toArray(new String[paths.size()])); } else { ZipUtil.removeEntry(zipFile, path.toString()); } }
/** * Alias to ZipUtil.containsEntry() * * @param name * entry to check existence of * @return true if zip archive we're processing contains entry by given name, false otherwise */ public boolean containsEntry(String name) { if (src == null) { throw new IllegalStateException("Source is not given"); } return ZipUtil.containsEntry(src, name); }
protected File getZipFile() { final File zipFile = new File(stagingDirectoryPath + ".zip"); final File stagingDirectory = new File(stagingDirectoryPath); ZipUtil.pack(stagingDirectory, zipFile); ZipUtil.removeEntry(zipFile, LOCAL_SETTINGS_FILE); return zipFile; } }
/** * Reads the given ZIP file and executes the given action for each entry. * <p> * For each entry the corresponding input stream is also passed to the action. If you want to stop the loop * then throw a ZipBreakException. * * @param zip * input ZIP file. * @param action * action to be called for each entry. * * @see ZipEntryCallback * @see #iterate(File, ZipInfoCallback) */ public static void iterate(File zip, ZipEntryCallback action) { iterate(zip, action, null); }
if(!ZipUtil.containsEntry(jarFile, "plugin.json")) { log.warn("Jar " + jarFile.getPath() + " does not contain a plugin.json"); continue; byte[] schemaBytes = ZipUtil.unpackEntry(jarFile, "plugin.json"); String schemaString = new String(schemaBytes); if (ZipUtil.containsEntry(jarFile, "config.json")) { schema.getFiles().add("config.json"); if (!ZipUtil.containsEntry(jarFile, filename)) { log.error("Plugin file " + filename + " for " + schema.getId() + " doesn't exist in jar"); return false; byte[] fileBytes = null; if (!pluginFile.exists()) { fileBytes = ZipUtil.unpackEntry(jarFile, filename); try { Files.write(pluginFile.toPath(), fileBytes); if(ZipUtil.containsEntry(jarFile, "config.json")) { File configFile = Paths.get(pluginDir.getPath(), "config.json").toFile(); byte[] configBytes = null;
public boolean act(File tmpFile) { removeEntry(zip, path, tmpFile); return true; } });
@Signature public boolean has(String path) { return ZipUtil.containsEntry(zipFile, path); }