Showing the changes to java (2 of 2 files). Show all
Unified · Split
| @@ -44,7 +44,7 @@ init( jni_p : JNI ) · 43 unmodified lines | |||
| 44 | #<< | 44 | #<< |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | open_rString_V( this : ref FileOutputStream_obj, p0 : JString) | 47 | open_rString_Z_V( this : ref FileOutputStream_obj, p0 : JString, p1 : int) |
| 48 | {#>> | 48 | {#>> |
| 49 | # open file pointed to by p0. If it does not exists, create it and | 49 | # open file pointed to by p0. If it does not exists, create it and |
| 50 | # and open it with mode of 644. | 50 | # and open it with mode of 644. |
| @@ -55,20 +55,12 @@ open_rString_V( this : ref FileOutputStream_obj, p0 : JString) · 4 unmodified lines | |||
| 55 | this.fd.fd = sys->create(p0.str, sys->OWRITE, 8r666); | 55 | this.fd.fd = sys->create(p0.str, sys->OWRITE, 8r666); |
| 56 | if(this.fd.fd == nil) | 56 | if(this.fd.fd == nil) |
| 57 | jni->ThrowException("java.io.IOException", sys->sprint("%r")); | 57 | jni->ThrowException("java.io.IOException", sys->sprint("%r")); |
| 58 | }#<< | ||
| 59 | |||
| 60 | openAppend_rString_V( this : ref FileOutputStream_obj, p0 : JString) | ||
| 61 | {#>> | ||
| 62 | if ((p0 == nil) || (p0.str == nil)) | ||
| 63 | jni->ThrowException("java.lang.NullPointerException", "null filename"); | ||
| 64 | 58 | ||
| 65 | this.fd.fd = sys->open(p0.str, sys->OWRITE); | 59 | if (p1) |
| 66 | if(this.fd.fd == nil) | 60 | sys->seek(this.fd.fd, big 0, sys->SEEKEND); |
| 67 | jni->ThrowException("java.io.IOException", sys->sprint("%r")); | ||
| 68 | sys->seek(this.fd.fd, big 0, sys->SEEKEND); | ||
| 69 | }#<< | 61 | }#<< |
| 70 | 62 | ||
| 71 | write_I_V( this : ref FileOutputStream_obj, p0 : int) | 63 | write_I_Z_V( this : ref FileOutputStream_obj, p0 : int, p1 : int) |
| 72 | {#>> | 64 | {#>> |
| 73 | # p0 == character to write | 65 | # p0 == character to write |
| 74 | c := array[1] of byte; | 66 | c := array[1] of byte; |
| @@ -77,11 +69,14 @@ write_I_V( this : ref FileOutputStream_obj, p0 : int) · 2 unmodified lines | |||
| 77 | if ((this.fd == nil) || (this.fd.fd == nil)) | 69 | if ((this.fd == nil) || (this.fd.fd == nil)) |
| 78 | jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor"); | 70 | jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor"); |
| 79 | 71 | ||
| 72 | if (p1) | ||
| 73 | sys->seek(this.fd.fd, big 0, sys->SEEKEND); | ||
| 74 | |||
| 80 | if (sys->write(this.fd.fd, c, 1) != 1) | 75 | if (sys->write(this.fd.fd, c, 1) != 1) |
| 81 | jni->ThrowException("java.io.IOException", sys->sprint("%r")); | 76 | jni->ThrowException("java.io.IOException", sys->sprint("%r")); |
| 82 | }#<< | 77 | }#<< |
| 83 | 78 | ||
| 84 | writeBytes_aB_I_I_V( this : ref FileOutputStream_obj, p0 : JArrayB,p1 : int,p2 : int) | 79 | writeBytes_aB_I_I_Z_V( this : ref FileOutputStream_obj, p0 : JArrayB,p1 : int,p2 : int, p3 : int) |
| 85 | {#>> | 80 | {#>> |
| 86 | # p0 == buffer array to write from | 81 | # p0 == buffer array to write from |
| 87 | # p1 == offset in buffer | 82 | # p1 == offset in buffer |
| @@ -94,6 +89,9 @@ writeBytes_aB_I_I_V( this : ref FileOutputStream_obj, p0 : JArrayB,p1 : int,p2 : · 6 unmodified lines | |||
| 94 | if ((p1 < 0) || (p2 < 0) || (p1 > (len p0.ary))) | 89 | if ((p1 < 0) || (p2 < 0) || (p1 > (len p0.ary))) |
| 95 | jni->ThrowException("java.lang.ArrayIndexOutOfBoundsException", nil); | 90 | jni->ThrowException("java.lang.ArrayIndexOutOfBoundsException", nil); |
| 96 | 91 | ||
| 92 | if (p3) | ||
| 93 | sys->seek(this.fd.fd, big 0, sys->SEEKEND); | ||
| 94 | |||
| 97 | n := 0; | 95 | n := 0; |
| 98 | while (p2 > 0) { | 96 | while (p2 > 0) { |
| 99 | # you can also write the following line as..... | 97 | # you can also write the following line as..... |
| @@ -9,10 +9,9 @@ FileOutputStream_L : module · 8 unmodified lines | |||
| 9 | }; | 9 | }; |
| 10 | 10 | ||
| 11 | init : fn( jni_p : JNI ); | 11 | init : fn( jni_p : JNI ); |
| 12 | open_rString_V : fn( this : ref FileOutputStream_obj, p0 : JString); | 12 | open_rString_Z_V : fn( this : ref FileOutputStream_obj, p0 : JString, p1 : int); |
| 13 | openAppend_rString_V : fn( this : ref FileOutputStream_obj, p0 : JString); | 13 | write_I_Z_V : fn( this : ref FileOutputStream_obj, p0 : int, p1 : int); |
| 14 | write_I_V : fn( this : ref FileOutputStream_obj, p0 : int); | 14 | writeBytes_aB_I_I_Z_V : fn( this : ref FileOutputStream_obj, p0 : JArrayB,p1 : int,p2 : int, p3 : int); |
| 15 | writeBytes_aB_I_I_V : fn( this : ref FileOutputStream_obj, p0 : JArrayB,p1 : int,p2 : int); | ||
| 16 | close0_V : fn( this : ref FileOutputStream_obj); | 15 | close0_V : fn( this : ref FileOutputStream_obj); |
| 17 | initIDs_V: fn( ); | 16 | initIDs_V: fn( ); |
| 18 | 17 | ||