Beispiel #1
0
 public static boolean copyFile(final File toCopy, final File destFile) {
   try {
     return FileUtils.copyStream(new FileInputStream(toCopy), new FileOutputStream(destFile));
   } catch (final FileNotFoundException e) {
     EmojiTools.submitError(e);
   }
   return false;
 }
Beispiel #2
0
 private static boolean copyStream(final InputStream is, final File f) {
   try {
     return FileUtils.copyStream(is, new FileOutputStream(f));
   } catch (final FileNotFoundException e) {
     EmojiTools.submitError(e);
   }
   return false;
 }
Beispiel #3
0
 public static boolean copyResourcesRecursively(final URL originUrl, final File destination) {
   try {
     final URLConnection urlConnection = originUrl.openConnection();
     if (urlConnection instanceof JarURLConnection) {
       return FileUtils.copyJarResourcesRecursively(destination, (JarURLConnection) urlConnection);
     } else {
       return FileUtils.copyFilesRecusively(
           new File(originUrl.getPath().replaceAll("%20", " ")), destination);
     }
   } catch (final IOException e) {
     EmojiTools.submitError(e);
   }
   return false;
 }
Beispiel #4
0
  private static boolean copyStream(final InputStream is, final OutputStream os) {
    try {
      final byte[] buf = new byte[1024];

      int len;
      while ((len = is.read(buf)) > 0) {
        os.write(buf, 0, len);
      }
      is.close();
      os.close();
      return true;
    } catch (final IOException e) {
      EmojiTools.submitError(e);
    }
    return false;
  }