List of usage examples for java.io File toString
public String toString()
From source file:com.blackducksoftware.integration.hub.detect.util.executable.Executable.java
public Executable(final File workingDirectory, final File executable, final List<String> executableArguments) { this(workingDirectory, executable.toString(), executableArguments); }
From source file:com.pushtechnology.mvndar.AddProjectOutputTask.java
@Override public void perform(final DARMojoContext context) throws IOException { final File outputDirectory = context.getOutputDirectory(); if (outputDirectory.exists()) { final DefaultFileSet fileSet = new DefaultFileSet(); fileSet.setDirectory(context.getOutputDirectory()); fileSet.setIncludes(or(context.getOutputIncludes(), DEFAULT_INCLUDES)); fileSet.setExcludes(or(context.getOutputExcludes(), DEFAULT_EXCLUDES)); final File target = FileUtils.getFile(context.getPrefixDirectoryName(), context.getExtDirectoryName()); fileSet.setPrefix(target.toString() + File.separator); context.getArchiver().addFileSet(fileSet); } else {// ww w. j a v a 2s . c om context.getLog().warn(outputDirectory + " does not exist, skipping"); } }
From source file:io.fabric8.vertx.maven.plugin.utils.IncrementalBuilder.java
@Override public void onDirectoryCreate(File directory) { buildObserver(Paths.get(directory.toString())); syncMonitor(); }
From source file:io.fabric8.vertx.maven.plugin.utils.IncrementalBuilder.java
@Override public void onDirectoryDelete(File directory) { observers.remove(Paths.get(directory.toString())); syncMonitor(); }
From source file:gool.executor.csharp.CSharpCompiler.java
@Override public File compileToExecutable(List<File> files, File mainFile, List<File> classPath, List<String> args) throws FileNotFoundException { List<String> params = new ArrayList<String>(); if (mainFile == null) { Log.i(files.toString());//from w w w.j a v a 2 s . c o m mainFile = files.get(0); } String execFileName = mainFile.getName().replace(".cs", ".exe"); params.addAll( Arrays.asList(Settings.get("csharp_compiler_cmd"), "-debug+", "/t:exe", "/out:" + execFileName)); /* * Add the needed dependencies to be able to compile programs. */ if (classPath != null) { for (File dependency : classPath) { params.add("/r:" + dependency.getAbsolutePath()); } } for (File dependency : getDependencies()) { params.add("/r:" + dependency.getAbsolutePath()); } for (File file : files) { params.add(file.toString()); } Command.exec(getOutputDir(), params); return new File(getOutputDir(), execFileName); }
From source file:ninja.eivind.hotsreplayuploader.models.ReplayFile.java
public ReplayFile(final File file) { this.file = file; this.fileName = file.toString(); }
From source file:gool.executor.csharp.CSharpCompiler.java
@Override public File compileToObjectFile(List<File> files, File mainFile, List<File> classPath, List<String> args) throws FileNotFoundException { // TODO Duplicate code in compile and compileAll if (mainFile == null) { Log.i(files.toString());/*from ww w . j a va 2 s. co m*/ mainFile = files.get(0); } String execFileName = mainFile.getName().replace(".cs", ".dll"); List<String> params = new ArrayList<String>(); params.addAll(Arrays.asList(Settings.get("csharp_compiler_cmd"), "-debug+", "/t:library")); /* * Add the needed dependencies to be able to compile programs. */ if (classPath != null) { for (File dependency : classPath) { params.add("/r:" + dependency.getAbsolutePath()); } } for (File dependency : getDependencies()) { params.add("/r:" + dependency.getAbsolutePath()); } for (File file : files) { params.add(file.toString()); } Command.exec(getOutputDir(), params); return new File(getOutputDir(), execFileName); }
From source file:net.rim.ejde.internal.util.PackageUtils.java
/** * Get the package id of the given <code>rrhFile</code>. * <p>/*w w w .j av a 2 s .com*/ * The returned package is in <code>com.rim.test</code> format. * </p> * * @param rrhFile * File * @return packageId String or <code>null</code> if the given file is null or the given file is not a rrh file * @throws CoreException */ public static String getRRHPackageID(File rrhFile) throws CoreException { if (rrhFile == null) { return null; } if (!rrhFile.getName().endsWith(RRH_FILE_EXTENSION_WITH_DOT)) { return null; } if (!rrhFile.exists()) { throw new CoreException(StatusFactory .createErrorStatus(NLS.bind(Messages.PackageUtils_RRH_FILE_NOT_EXIST, rrhFile.toString()))); } String fileStringPath = rrhFile.getPath(); ResourceCollection collection = new ResourceCollection( fileStringPath.substring(0, fileStringPath.length() - 4)); ResourceHeaderParser parser = null; String packageName = null; try { parser = new ResourceHeaderParser(fileStringPath, collection); parser.read(); } catch (IOException e) { _logger.error(NLS.bind(Messages.PackageUtils_PACKAGE_ID_ERROR_MSG, rrhFile.toString())); throw new CoreException(StatusFactory.createErrorStatus( NLS.bind(Messages.PackageUtils_PACKAGE_ID_ERROR_MSG, rrhFile.toString()), e)); } packageName = collection.getPackage(); return packageName; }
From source file:com.goliathonline.android.kegbot.util.BitmapUtils.java
/** * Only call this method from the main (UI) thread. The {@link OnFetchCompleteListener} callback * be invoked on the UI thread, but image fetching will be done in an {@link AsyncTask}. * * @param cookie An arbitrary object that will be passed to the callback. *//*from ww w. j a v a 2 s . co m*/ public static void fetchImage(final Context context, final String url, final BitmapFactory.Options decodeOptions, final Object cookie, final OnFetchCompleteListener callback) { new AsyncTask<String, Void, Bitmap>() { @Override protected Bitmap doInBackground(String... params) { final String url = params[0]; if (TextUtils.isEmpty(url)) { return null; } // First compute the cache key and cache file path for this URL File cacheFile = null; try { MessageDigest mDigest = MessageDigest.getInstance("SHA-1"); mDigest.update(url.getBytes()); final String cacheKey = bytesToHexString(mDigest.digest()); if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) { cacheFile = new File(Environment.getExternalStorageDirectory() + File.separator + "Android" + File.separator + "data" + File.separator + context.getPackageName() + File.separator + "cache" + File.separator + "bitmap_" + cacheKey + ".tmp"); } } catch (NoSuchAlgorithmException e) { // Oh well, SHA-1 not available (weird), don't cache bitmaps. } if (cacheFile != null && cacheFile.exists()) { Bitmap cachedBitmap = BitmapFactory.decodeFile(cacheFile.toString(), decodeOptions); if (cachedBitmap != null) { return cachedBitmap; } } try { // TODO: check for HTTP caching headers final HttpClient httpClient = SyncService.getHttpClient(context.getApplicationContext()); final HttpResponse resp = httpClient.execute(new HttpGet(url)); final HttpEntity entity = resp.getEntity(); final int statusCode = resp.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK || entity == null) { return null; } final byte[] respBytes = EntityUtils.toByteArray(entity); // Write response bytes to cache. if (cacheFile != null) { try { cacheFile.getParentFile().mkdirs(); cacheFile.createNewFile(); FileOutputStream fos = new FileOutputStream(cacheFile); fos.write(respBytes); fos.close(); } catch (FileNotFoundException e) { Log.w(TAG, "Error writing to bitmap cache: " + cacheFile.toString(), e); } catch (IOException e) { Log.w(TAG, "Error writing to bitmap cache: " + cacheFile.toString(), e); } } // Decode the bytes and return the bitmap. return BitmapFactory.decodeByteArray(respBytes, 0, respBytes.length, decodeOptions); } catch (Exception e) { Log.w(TAG, "Problem while loading image: " + e.toString(), e); } return null; } @Override protected void onPostExecute(Bitmap result) { callback.onFetchComplete(cookie, result); } }.execute(url); }
From source file:gool.executor.cpp.CppCompiler.java
@Override public File compileToExecutable(List<File> files, File mainFile, List<File> classPath, List<String> args) throws FileNotFoundException { List<String> params = new ArrayList<String>(); if (mainFile == null) { mainFile = files.get(0);/* ww w . j a v a 2s. co m*/ } Log.i("--->" + mainFile); String execFileName = mainFile.getName().replace(".cpp", ".bin"); params.addAll(Arrays.asList(Settings.get("cpp_compiler_cmd"), "-I", Settings.get("boost_lib_dir"), "-o", execFileName)); /* * Add the needed dependencies to be able to compile programs. */ if (classPath != null) { for (File dependency : classPath) { params.add(dependency.getAbsolutePath()); } } for (File dependency : getDependencies()) { params.add(dependency.getAbsolutePath()); } for (File file : files) { if (!params.contains(file.toString())) params.add(file.toString()); } Command.exec(getOutputDir(), params); return new File(getOutputDir(), execFileName); }