Reversed vftbl movement because of performance considerations
[cacao.git] / nat / SocketOutputStream.c
1 /* class: java/net/SocketOutputStream */
2
3 /*
4  * Class:     java/net/SocketOutputStream
5  * Method:    init
6  * Signature: ()V
7  */
8 JNIEXPORT void JNICALL
9 Java_java_net_SocketOutputStream_init (JNIEnv *env )
10 {
11     if (runverbose)
12         log_text("Java_java_net_SocketOutputStream_init called");
13 }
14
15 /*
16  * Class:     java/net/SocketOutputStream
17  * Method:    socketWrite
18  * Signature: ([BII)V
19  */
20 JNIEXPORT void JNICALL
21 Java_java_net_SocketOutputStream_socketWrite (JNIEnv *env,  struct java_net_SocketOutputStream* this, java_bytearray* buf, s4 offset, s4 len)
22 {
23         int r;
24
25         if (runverbose)
26             log_text("Java_java_net_SocketOutputStream_socketWrite called");
27
28 #ifdef USE_THREADS
29         assert(blockInts == 0);
30 #endif
31
32         if (this->impl->fd->fd < 0) {
33                 /* exceptionptr = native_new_and_init (class_java_io_IOException); */
34                 return;
35         }
36         r = threadedWrite(this->impl->fd->fd, &buf->data[offset], len);
37         if (r < 0) {
38                 exceptionptr = native_new_and_init (class_java_io_IOException);
39                 return;
40         }
41         assert(r == len);
42
43 #ifdef USE_THREADS
44         assert(blockInts == 0);
45 #endif
46 }