| 755 | } |
| 756 | |
| 757 | extern "C" JNIEXPORT jint JNICALL |
| 758 | Java_java_io_FileInputStream_read__I_3BII(JNIEnv* e, |
| 759 | jclass, |
| 760 | jint fd, |
| 761 | jbyteArray b, |
| 762 | jint offset, |
| 763 | jint length) |
| 764 | { |
| 765 | jbyte* data = static_cast<jbyte*>(malloc(length)); |
| 766 | if (data == 0) { |
| 767 | throwNew(e, "java/lang/OutOfMemoryError", 0); |
| 768 | return 0; |
| 769 | } |
| 770 | |
| 771 | int r = doRead(e, fd, data, length); |
| 772 | |
| 773 | e->SetByteArrayRegion(b, offset, length, data); |
| 774 | |
| 775 | free(data); |
| 776 | |
| 777 | return r; |
| 778 | } |
| 779 | |
| 780 | extern "C" JNIEXPORT void JNICALL |
| 781 | Java_java_io_FileInputStream_close(JNIEnv* e, jclass, jint fd) |