JNIEnv is shared in the same thread

This commit is contained in:
tarsin committed 2022-07-21 21:56:32 +08:00
1 parent a91547ace7
commit 9ea7cd5f7c
2 files changed
+74 -74

No files matched your search

@@ -31,7 +31,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
public class UriArchiveAccessor implements Closeable {
public class UriArchiveAccessor implements AutoCloseable {
public static int OPEN_OK = 1;
public static int OPEN_ERR = 2;
private final OsReadableFile osf;
@@ -45,15 +45,18 @@ public class UriArchiveAccessor implements Closeable {
}
public void extractTargetIndexToOutputStream(int index, OutputStream os) {
extracttoOutputStream(osf, index, os);
extracttoOutputStream(index, os);
}
private native int openArchive(OsReadableFile osf);
private native int extracttoOutputStream(OsReadableFile osf, int index, OutputStream os);
private native void extracttoOutputStream(int index, OutputStream os);
private native void closeArchive();
@Override
public void close() throws IOException {
closeArchive();
osf.close();
}