mirror of
https://github.com/corda/corda.git
synced 2025-01-23 12:58:35 +00:00
implement avian.Handler.ResourceInputStream.available
This commit is contained in:
parent
93c9395f1d
commit
64e42da348
@ -63,6 +63,12 @@ public class Handler extends URLStreamHandler {
|
|||||||
|
|
||||||
public static native void close(long peer) throws IOException;
|
public static native void close(long peer) throws IOException;
|
||||||
|
|
||||||
|
public static native int available(long peer, int position);
|
||||||
|
|
||||||
|
public int available() {
|
||||||
|
return available(peer, position);
|
||||||
|
}
|
||||||
|
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
if (peer != 0) {
|
if (peer != 0) {
|
||||||
int c = read(peer, position);
|
int c = read(peer, position);
|
||||||
|
@ -87,7 +87,7 @@ Avian_avian_SystemClassLoader_resourceExists
|
|||||||
|
|
||||||
bool r = getFinder(t, loader)->exists(RUNTIME_ARRAY_BODY(n));
|
bool r = getFinder(t, loader)->exists(RUNTIME_ARRAY_BODY(n));
|
||||||
|
|
||||||
fprintf(stderr, "resource %s exists? %d\n", n, r);
|
// fprintf(stderr, "resource %s exists? %d\n", n, r);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
} else {
|
} else {
|
||||||
@ -186,6 +186,17 @@ Avian_avian_resource_Handler_00024ResourceInputStream_open
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" JNIEXPORT int64_t JNICALL
|
||||||
|
Avian_avian_resource_Handler_00024ResourceInputStream_available
|
||||||
|
(Thread*, object, uintptr_t* arguments)
|
||||||
|
{
|
||||||
|
int64_t peer; memcpy(&peer, arguments, 8);
|
||||||
|
int32_t position = arguments[2];
|
||||||
|
|
||||||
|
System::Region* region = reinterpret_cast<System::Region*>(peer);
|
||||||
|
return static_cast<jint>(region->length()) - position;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" JNIEXPORT int64_t JNICALL
|
extern "C" JNIEXPORT int64_t JNICALL
|
||||||
Avian_avian_resource_Handler_00024ResourceInputStream_read__JI
|
Avian_avian_resource_Handler_00024ResourceInputStream_read__JI
|
||||||
(Thread*, object, uintptr_t* arguments)
|
(Thread*, object, uintptr_t* arguments)
|
||||||
|
Loading…
Reference in New Issue
Block a user