| 810 | } |
| 811 | |
| 812 | extern "C" JNIEXPORT void JNICALL |
| 813 | Java_java_io_FileOutputStream_write__I_3BII(JNIEnv* e, |
| 814 | jclass, |
| 815 | jint fd, |
| 816 | jbyteArray b, |
| 817 | jint offset, |
| 818 | jint length) |
| 819 | { |
| 820 | jbyte* data = static_cast<jbyte*>(malloc(length)); |
| 821 | |
| 822 | if (data == 0) { |
| 823 | throwNew(e, "java/lang/OutOfMemoryError", 0); |
| 824 | return; |
| 825 | } |
| 826 | |
| 827 | e->GetByteArrayRegion(b, offset, length, data); |
| 828 | if (not e->ExceptionCheck()) { |
| 829 | doWrite(e, fd, data, length); |
| 830 | } |
| 831 | |
| 832 | free(data); |
| 833 | } |
| 834 | |
| 835 | extern "C" JNIEXPORT void JNICALL |
| 836 | Java_java_io_FileOutputStream_close(JNIEnv* e, jclass, jint fd) |