How to export all files and folders in resources folder in java -


how in java code copy src/main/resources directory curent working directory?

my files

this found org.bukkit.plugin.java.javaplugin , seems work

public void saveresource(string resourcepath, boolean replace) {     if (resourcepath == null || resourcepath.equals("")) {         throw new illegalargumentexception("resourcepath cannot null or empty");     }      resourcepath = resourcepath.replace('\\', '/');     inputstream in = getresource(resourcepath);     if (in == null) {         throw new illegalargumentexception("the embedded resource '" + resourcepath + "' cannot found");     }      file outfile = new file(datafolder, resourcepath);     int lastindex = resourcepath.lastindexof('/');     file outdir = new file(datafolder, resourcepath.substring(0, lastindex >= 0 ? lastindex : 0));      if (!outdir.exists()) {         outdir.mkdirs();     }      try {         if (!outfile.exists() || replace) {             outputstream out = new fileoutputstream(outfile);             byte[] buf = new byte[1024];             int len;             while ((len = in.read(buf)) > 0) {                 out.write(buf, 0, len);             }             out.close();             in.close();         } else {             logger.log(level.warning, "could not save " + outfile.getname() + " " + outfile + " because "                     + outfile.getname() + " exists.");         }     } catch (ioexception ex) {         logger.log(level.severe, "could not save " + outfile.getname() + " " + outfile, ex);     } } 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -