WIP
parent
2b82d4e021
commit
b5d9b6eed2
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue