comparison 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
comparison
equal deleted inserted replaced
256:8d1948844918 257:cc1d3de0e80b
6 public import dwt.dwthelper.File; 6 public import dwt.dwthelper.File;
7 public import dwt.dwthelper.OutputStream; 7 public import dwt.dwthelper.OutputStream;
8 8
9 import dwt.dwthelper.utils; 9 import dwt.dwthelper.utils;
10 10
11 import tango.io.FileConduit;
12
11 public class FileOutputStream : dwt.dwthelper.OutputStream.OutputStream { 13 public class FileOutputStream : dwt.dwthelper.OutputStream.OutputStream {
12 14
13 alias dwt.dwthelper.OutputStream.OutputStream.write write; 15 alias dwt.dwthelper.OutputStream.OutputStream.write write;
14 alias dwt.dwthelper.OutputStream.OutputStream.close close; 16 alias dwt.dwthelper.OutputStream.OutputStream.close close;
15 17 FileConduit fc;
18
16 public this ( String name ){ 19 public this ( String name ){
17 implMissing( __FILE__, __LINE__ ); 20 fc = new FileConduit( name, FileConduit.WriteCreate );
18 } 21 }
19 22
20 public this ( String name, bool append ){ 23 public this ( String name, bool append ){
21 implMissing( __FILE__, __LINE__ ); 24 fc = new FileConduit( name, append ? FileConduit.WriteAppending : FileConduit.WriteCreate );
22 } 25 }
23 26
24 public this ( dwt.dwthelper.File.File file ){ 27 public this ( dwt.dwthelper.File.File file ){
25 implMissing( __FILE__, __LINE__ ); 28 this( file.toString );
26 } 29 }
27 30
28 public this ( dwt.dwthelper.File.File file, bool append ){ 31 public this ( dwt.dwthelper.File.File file, bool append ){
29 implMissing( __FILE__, __LINE__ ); 32 this( file.toString, append );
30 } 33 }
31 34
32 public void write( int b ){ 35 public override void write( int b ){
33 implMissing( __FILE__, __LINE__ ); 36 ubyte[1] a;
37 a[0] = b & 0xFF;
38 fc.write(a);
34 } 39 }
35 40
36 public void write( byte[] b ){ 41 public override void close(){
37 implMissing( __FILE__, __LINE__ ); 42 fc.close();
38 }
39
40 public void write( byte[] b, int off, int len ){
41 implMissing( __FILE__, __LINE__ );
42 }
43
44 public void close(){
45 implMissing( __FILE__, __LINE__ );
46 } 43 }
47 44
48 public void finalize(){ 45 public void finalize(){
49 implMissing( __FILE__, __LINE__ ); 46 implMissing( __FILE__, __LINE__ );
50 } 47 }