diff dwt/dwthelper/FileOutputStream.d @ 257:cc1d3de0e80b

Fix: make ImageLoader.save work
author Frank Benoit <benoit@tionex.de>
date Tue, 24 Jun 2008 22:12:18 +0200
parents 380bad9f6852
children a2166f25ce17
line wrap: on
line diff
--- a/dwt/dwthelper/FileOutputStream.d	Fri Jun 20 15:03:54 2008 +0200
+++ b/dwt/dwthelper/FileOutputStream.d	Tue Jun 24 22:12:18 2008 +0200
@@ -8,41 +8,38 @@
 
 import dwt.dwthelper.utils;
 
+import tango.io.FileConduit;
+
 public class FileOutputStream : dwt.dwthelper.OutputStream.OutputStream {
 
     alias dwt.dwthelper.OutputStream.OutputStream.write write;
     alias dwt.dwthelper.OutputStream.OutputStream.close close;
-
+    FileConduit fc;
+    
     public this ( String name ){
-        implMissing( __FILE__, __LINE__ );
+        fc = new FileConduit( name, FileConduit.WriteCreate );
     }
 
     public this ( String name, bool append ){
-        implMissing( __FILE__, __LINE__ );
+        fc = new FileConduit( name, append ? FileConduit.WriteAppending : FileConduit.WriteCreate );
     }
 
     public this ( dwt.dwthelper.File.File file ){
-        implMissing( __FILE__, __LINE__ );
+        this( file.toString );
     }
 
     public this ( dwt.dwthelper.File.File file, bool append ){
-        implMissing( __FILE__, __LINE__ );
-    }
-
-    public void write( int b ){
-        implMissing( __FILE__, __LINE__ );
+        this( file.toString, append );
     }
 
-    public void write( byte[] b ){
-        implMissing( __FILE__, __LINE__ );
+    public override void write( int b ){
+        ubyte[1] a;
+        a[0] = b & 0xFF;
+        fc.write(a);
     }
 
-    public void write( byte[] b, int off, int len ){
-        implMissing( __FILE__, __LINE__ );
-    }
-
-    public void close(){
-        implMissing( __FILE__, __LINE__ );
+    public override void close(){
+        fc.close();
     }
 
     public void finalize(){