fix API: изменение работы метода SaveResource
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
<groupId>asys</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>0.8</version>
|
||||
<version>0.9</version>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -43,17 +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);
|
||||
public static void SaveResource(InputStream resourceAsStream, File saveTo) throws IOException {
|
||||
if (resourceAsStream == null) {
|
||||
throw new NullPointerException("Resource not found! (stream == null)");
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(saveTo);
|
||||
byte[] buff = new byte[65536];
|
||||
int len;
|
||||
while ((len = stream.read(buff)) > 0) {
|
||||
while ((len = resourceAsStream.read(buff)) > 0) {
|
||||
fos.write(buff, 0, len);
|
||||
}
|
||||
fos.flush();
|
||||
fos.close();
|
||||
stream.close();
|
||||
resourceAsStream.close();
|
||||
}
|
||||
|
||||
private static Dictionary<String, Object> getCommandListByAnnotationMethods(String scope, Class<?> clazz) {
|
||||
|
||||
Reference in New Issue
Block a user