7 #include "structdefs.h"
10 #include "methodheaders.h"
12 #include "InputFileArrays.h"
15 #ifdef D___FileOutputStream______nativeWrite____I__AR_B_I_I
16 void CALL34(___FileOutputStream______nativeWrite____I__AR_B_I_I, int fd, int off, int len, int fd, struct ArrayObject * ___array___, int off, int len) {
19 char * string= (((char *)&VAR(___array___)->___length___)+sizeof(int));
20 int status=write(fd, &string[off], len);
25 #ifdef D___FileOutputStream______nativeClose____I
26 void CALL11(___FileOutputStream______nativeClose____I, int fd, int fd) {
34 #ifdef D___FileOutputStream______nativeFlush____I
35 void CALL11(___FileOutputStream______nativeFlush____I, int fd, int fd) {
36 // not supported in RAW version
44 #ifdef D___FileOutputStream______nativeOpen_____AR_B
45 int CALL01(___FileOutputStream______nativeOpen_____AR_B, struct ArrayObject * ___filename___) {
46 int length=VAR(___filename___)->___length___;
47 char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int));
50 int fd=filename2fd(filename, length);
56 int fd=open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU);
62 #ifdef D___FileOutputStream______nativeAppend_____AR_B
63 int CALL01(___FileOutputStream______nativeAppend_____AR_B, struct ArrayObject * ___filename___) {
67 int length=VAR(___filename___)->___length___;
68 char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int));
69 int fd=open(filename, O_WRONLY|O_CREAT|O_APPEND, S_IRWXU);
75 #ifdef D___FileInputStream______nativeOpen_____AR_B
76 int CALL01(___FileInputStream______nativeOpen_____AR_B, struct ArrayObject * ___filename___) {
77 int length=VAR(___filename___)->___length___;
78 char* filename= (((char *)&VAR(___filename___)->___length___)+sizeof(int));
81 int fd=filename2fd(filename, length);
88 if ((fd=open(filename, O_RDONLY, 0)) < 0) {
90 perror("open failed");
91 printf("filename is %s\n", filename);
100 #ifdef D___FileInputStream______nativeClose____I
101 void CALL11(___FileInputStream______nativeClose____I, int fd, int fd) {
109 #ifdef D___FileInputStream______nativeRead____I__AR_B_I
110 int CALL23(___FileInputStream______nativeRead____I__AR_B_I, int fd, int numBytes, int fd, struct ArrayObject * ___array___, int numBytes) {
114 int toread=VAR(___array___)->___length___;
115 char* string= (((char *)&VAR(___array___)->___length___)+sizeof(int));
121 if ((status=read(fd, string, toread)) < 0) {
129 #ifdef D___FileInputStream______nativePeek____I
130 int CALL11(___FileInputStream______nativePeek____I, int fd, int fd) {
136 status=read(fd, string, 1);
141 lseek(fd, -1, SEEK_CUR);
147 #ifdef D___File______nativeLength_____AR_B
148 long long CALL01(___File______nativeLength_____AR_B, struct ArrayObject * ___pathname___) {
152 int length=VAR(___pathname___)->___length___;
153 char* filename= (((char *)&VAR(___pathname___)->___length___)+sizeof(int));
161 #ifdef D___FileInputStream______nativeAvailable____I
162 int CALL11(___FileInputStream______nativeAvailable____I, int fd, int fd) {
167 int cur=lseek(fd, 0, SEEK_CUR);
168 int fsize = lseek(fd, 0, SEEK_END);
169 lseek(fd,cur,SEEK_SET); // seek back to the current position