Log the webserver requests
[IRC.git] / Robust / src / ClassLibrary / FileOutputStream.java
1 public class FileOutputStream {
2     private int fd;
3
4     public FileOutputStream(String pathname) {
5         fd=nativeOpen(pathname.getBytes());
6     }
7
8     public FileOutputStream(String pathname, int mode) {
9         if(mode==0)     
10                 fd=nativeAppend(pathname.getBytes());
11         if(mode==1)
12                 fd=nativeOpen(pathname.getBytes());
13     }
14
15
16     public FileOutputStream(File path) {
17         fd=nativeOpen(path.getPath().getBytes());
18     }
19
20     private static native int nativeOpen(byte[] filename);
21     private static native int nativeAppend(byte[] filename);
22     private static native void nativeWrite(int fd, byte[] array);
23     private static native void nativeClose(int fd);
24     
25     public void write(int ch) {
26         byte b[]=new byte[1];
27         b[0]=(byte)ch;
28         write(b);
29     }
30
31     public void write(byte[] b) {
32         nativeWrite(fd, b);
33     }
34
35     public void close() {
36         nativeClose(fd);
37     }
38 }