This commit was manufactured by cvs2svn to create tag 'buildscript'.
[IRC.git] /
1 public class FileOutputStream extends OutputStream {
2   private int fd;
3
4   public FileOutputStream(String pathname) {
5     fd=nativeOpen(pathname.getBytes());
6   }
7
8   public FileOutputStream(String pathname, boolean append) {
9     if(append)
10       fd=nativeAppend(pathname.getBytes());
11     else
12       fd=nativeOpen(pathname.getBytes());
13   }
14
15   public FileOutputStream(String pathname, int mode) {
16     if(mode==0)
17       fd=nativeAppend(pathname.getBytes());
18     if(mode==1)
19       fd=nativeOpen(pathname.getBytes());
20   }
21
22   public FileOutputStream(File path) {
23     fd=nativeOpen(path.getPath().getBytes());
24   }
25
26   public FileOutputStreamOpen(String pathname) {
27     fd = nativeOpen(pathname.getBytes());
28   }
29
30   private static native int nativeOpen(byte[] filename);
31   private static native int nativeAppend(byte[] filename);
32   private static native void nativeWrite(int fd, byte[] array, int off, int len);
33   private static native void nativeClose(int fd);
34   private static native void nativeFlush(int fd);
35
36   public void write(int ch) {
37     byte b[]=new byte[1];
38     b[0]=(byte)ch;
39     write(b);
40   }
41
42   public void write(byte[] b) {
43     nativeWrite(fd, b, 0, b.length);
44   }
45
46   public void write(byte[] b, int index, int len) {
47     nativeWrite(fd, b, index, len);
48   }
49
50   public void flush() {
51     nativeFlush(fd);
52   }
53
54   public void close() {
55     nativeClose(fd);
56   }
57 }