Mercurial > projects > dwt2
diff java/src/java/io/FileOutputStream.d @ 0:6dd524f61e62
add dwt win and basic java stuff
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 02 Mar 2009 14:44:16 +0100 |
parents | |
children | 2847134a5fc0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/src/java/io/FileOutputStream.d Mon Mar 02 14:44:16 2009 +0100 @@ -0,0 +1,56 @@ +/** + * Authors: Frank Benoit <keinfarbton@googlemail.com> + */ +module java.io.FileOutputStream; + +public import java.io.File; +public import java.io.OutputStream; + +import java.lang.all; + +version(TANGOSVN){ +import TangoFile = tango.io.device.File; +} else { +import TangoFile = tango.io.FileConduit; +} + +public class FileOutputStream : java.io.OutputStream.OutputStream { + + alias java.io.OutputStream.OutputStream.write write; + alias java.io.OutputStream.OutputStream.close close; + TangoFile.File fc; + + public this ( String name ){ + fc = new TangoFile.File( name, TangoFile.File.WriteCreate ); + } + + public this ( String name, bool append ){ + fc = new TangoFile.File( name, append ? TangoFile.File.WriteAppending : TangoFile.File.WriteCreate ); + } + + public this ( java.io.File.File file ){ + this( file.toString ); + } + + public this ( java.io.File.File file, bool append ){ + this( file.toString, append ); + } + + public override void write( int b ){ + ubyte[1] a; + a[0] = b & 0xFF; + fc.write(a); + } + + public override void close(){ + fc.close(); + } + + public void finalize(){ + implMissing( __FILE__, __LINE__ ); + } + + +} + +