Skip to content

Commit f0233ab

Browse files
committed
1.61
1 parent 1a0bfeb commit f0233ab

File tree

5 files changed

+11
-54
lines changed

5 files changed

+11
-54
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package dev.felnull.fnjl;
22

33
public class FNJLBuildIn {
4-
protected static final String VERSION = "1.60";
4+
protected static final String VERSION = "1.61";
55
}

common/src/main/java/dev/felnull/fnjl/util/FNDataUtil.java

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -281,63 +281,20 @@ public static byte[] fileLoadToProgress(File file, Consumer<ProgressWriter.Write
281281

282282
/**
283283
* リソースフォルダからデータを抽出
284-
* {@link #resourceExtracted}を利用してください
285284
*
286285
* @param clazz リソースフォルダのクラス
287286
* @param path リソースパス
288287
* @return InputStream
289288
*/
290289
@Nullable
291-
@Deprecated
292290
public static InputStream resourceExtractor(@NotNull Class<?> clazz, @NotNull String path) {
293-
try {
294-
return resourceBufferedExtracted(clazz, path);
295-
} catch (IOException e) {
296-
throw new RuntimeException(e);
297-
}
298-
}
299-
300-
/**
301-
* リソースフォルダからデータを抽出
302-
*
303-
* @param clazz リソースフォルダのクラス
304-
* @param path リソースパス
305-
* @return InputStream
306-
*/
307-
public static InputStream resourceExtracted(@NotNull Class<?> clazz, @NotNull String path) throws IOException {
308-
if (path.startsWith("/")) path = path.substring(1);
309-
310-
try (InputStream stream = clazz.getResourceAsStream("/" + path)) {
311-
if (stream != null)
312-
return stream;
313-
}
314-
315-
try (InputStream stream = ClassLoader.getSystemResourceAsStream(path)) {
316-
if (stream != null)
317-
return stream;
318-
}
319-
320-
return null;
321-
}
291+
if (path.startsWith("/"))
292+
path = path.substring(1);
322293

323-
/**
324-
* リソースフォルダからデータを抽出(バッファ)
325-
*
326-
* @param clazz リソースフォルダのクラス
327-
* @param path リソースパス
328-
* @return InputStream
329-
* @throws IOException 例外
330-
*/
331-
@Nullable
332-
public static InputStream resourceBufferedExtracted(@NotNull Class<?> clazz, @NotNull String path) throws IOException {
333-
try (InputStream stream = resourceExtracted(clazz, path)) {
334-
if (stream != null) {
335-
try (InputStream bufStream = new BufferedInputStream(stream)) {
336-
return bufStream;
337-
}
338-
}
339-
}
340-
return null;
294+
InputStream stream = clazz.getResourceAsStream("/" + path);
295+
if (stream == null)
296+
stream = ClassLoader.getSystemResourceAsStream(path);
297+
return stream != null ? new BufferedInputStream(stream) : null;
341298
}
342299

343300
/**

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fnjl_group=dev.felnull
22
fnjl_name=felnull-java-library
3-
fnjl_version=1.60
3+
fnjl_version=1.61
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package dev.felnull.fnjln;
22

33
public class FNJLNBuildIn {
4-
protected static final String VERSION = "1.60";
4+
protected static final String VERSION = "1.61";
55

66
protected static final int NATIVE_LIBRARY_VERSION = 1;
77
}

natives/src/main/java/dev/felnull/fnjln/FelNullJavaLibraryNatives.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class FelNullJavaLibraryNatives {
2626
public synchronized static void init() {
2727
String tempDir = System.getProperty("java.io.tmpdir");
2828
Path path = Paths.get(tempDir).resolve("fnjl_natives");
29-
path.toFile().mkdirs();
29+
FNDataUtil.wishMkdir(path.toFile());
3030
init(path);
3131
}
3232

@@ -63,7 +63,7 @@ public synchronized static void init(String libraryLocation, Path libraryPath) {
6363
return;
6464
}
6565

66-
try (InputStream stream = FNDataUtil.resourceBufferedExtracted(FelNullJavaLibraryNatives.class, libraryLocation + libName)) {
66+
try (InputStream stream = FNDataUtil.resourceExtractor(FelNullJavaLibraryNatives.class, libraryLocation + libName)) {
6767
if (stream != null) {
6868
byte[] data = FNDataUtil.streamToByteArray(stream);
6969
outLibFIle.delete();

0 commit comments

Comments
 (0)