diff --git a/API/pom.xml b/API/pom.xml index 6c4ad53..a7d6f7d 100644 --- a/API/pom.xml +++ b/API/pom.xml @@ -19,7 +19,7 @@ asys api - 0.7 + 0.8 bundle diff --git a/API/src/main/java/asys/api/ASysUtils.java b/API/src/main/java/asys/api/ASysUtils.java index 1ca08e5..8cb6f78 100644 --- a/API/src/main/java/asys/api/ASysUtils.java +++ b/API/src/main/java/asys/api/ASysUtils.java @@ -7,6 +7,10 @@ package asys.api; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.lang.reflect.Method; import java.util.Dictionary; import java.util.Hashtable; @@ -39,6 +43,19 @@ public class ASysUtils { System.out.printf(format+"\n", objects); } + public static void SaveResource(String resource, File saveTo) throws IOException { + InputStream stream = ASysUtils.class.getResourceAsStream(resource); + FileOutputStream fos = new FileOutputStream(saveTo); + byte[] buff = new byte[65536]; + int len; + while ((len = stream.read(buff)) > 0) { + fos.write(buff, 0, len); + } + fos.flush(); + fos.close(); + stream.close(); + } + private static Dictionary getCommandListByAnnotationMethods(String scope, Class clazz) { List listCommand = new Vector<>();