fd=nativeOpen(pathname.getBytes());
}
+ public FileOutputStream(String pathname, int mode) {
+ if(mode==0)
+ fd=nativeAppend(pathname.getBytes());
+ if(mode==1)
+ fd=nativeOpen(pathname.getBytes());
+ }
+
+
public FileOutputStream(File path) {
fd=nativeOpen(path.getPath().getBytes());
}
private static native int nativeOpen(byte[] filename);
+ private static native int nativeAppend(byte[] filename);
private static native void nativeWrite(int fd, byte[] array);
private static native void nativeClose(int fd);
return fd;
}
+int ___FileOutputStream______nativeAppend_____AR_B(struct ArrayObject * ao) {
+ int length=ao->___length___;
+ char* filename= (((char *)& ao->___length___)+sizeof(int));
+ int fd=open(filename, O_WRONLY|O_CREAT|O_APPEND, S_IRWXU);
+ return fd;
+}
+
int ___FileInputStream______nativeOpen_____AR_B(struct ArrayObject * ao) {
int length=ao->___length___;
char* filename= (((char *)& ao->___length___)+sizeof(int));
--- /dev/null
+public class Logger extends FileOutputStream {
+ //Logging flag
+ flag LogPending;
+
+ //Constructor
+ public Logger(){
+ }
+
+ public void logrequest(){
+ String filepath = new String("./Tests/htmlfiles/request.log");
+ String request = new String(" New Request received\n");
+ int mode=0;
+ FileOutputStream logfile = new FileOutputStream(filepath,mode);
+ logfile.write(request.getBytes());
+ logfile.close();
+ }
+
+}