Merge branch 'master' of schwann.lupus:/git/java/org.hwo.platform

master
Harald Wolff 2017-09-01 20:13:06 +02:00
commit 48e0d2dd6e
1 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package org.hwo.platform;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.hwo.platform.natives.NativeLoader;
@ -21,12 +22,24 @@ public class Ressource {
);
}
public static byte[] load(String resource){
try {
return load(NativeLoader.class.getResourceAsStream(resource));
} catch (IOException ioe){
return null;
}
}
public static byte[] load(InputStream in) throws IOException{
byte[] buffer = new byte[in.available()];
in.read(buffer);
return buffer;
}
private static boolean extract(InputStream in,String filename){
try {
FileOutputStream fos = new FileOutputStream(filename);
byte[] buffer = new byte[in.available()];
in.read(buffer);
fos.write(buffer);
FileOutputStream fos = new FileOutputStream(filename);
fos.write(load(in));
fos.close();
return true;