DimDoors/StevenDimDoors/mod_pocketDim/helpers/copyfile.java
SenseiKiwi 63be7fefc1 Tweaked Dungeon Tutorial Copy Code
Tweaked the code that copies the dungeon export tutorial. I'm not sure
it worked all the time before. It didn't seem quite right. I've
confirmed it's working better now. Also cleaned up copyfile a little.
2013-06-16 10:54:03 -04:00

31 lines
No EOL
629 B
Java

package StevenDimDoors.mod_pocketDim.helpers;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
public class copyfile
{
public static boolean copyFile(String ori, String dest)
{
try
{
InputStream in = (mod_pocketDim.class.getClass().getResourceAsStream(ori));
OutputStream out = new FileOutputStream(dest);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}
catch(Exception e)
{
return false;
}
return true;
}
}