Mercurial > projects > dwt-win
annotate dwt/dwthelper/FileOutputStream.d @ 308:8d53428f9be0
Tango breaking change for new package tango.io.device
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 14 Sep 2008 19:58:20 +0200 |
parents | 32a6819fef61 |
children | 1ee938a6e02e |
rev | line source |
---|---|
0 | 1 /** |
2 * Authors: Frank Benoit <keinfarbton@googlemail.com> | |
3 */ | |
4 module dwt.dwthelper.FileOutputStream; | |
5 | |
6 public import dwt.dwthelper.File; | |
7 public import dwt.dwthelper.OutputStream; | |
8 | |
9 import dwt.dwthelper.utils; | |
10 | |
308
8d53428f9be0
Tango breaking change for new package tango.io.device
Frank Benoit <benoit@tionex.de>
parents:
242
diff
changeset
|
11 version(TANGOSVN){ |
8d53428f9be0
Tango breaking change for new package tango.io.device
Frank Benoit <benoit@tionex.de>
parents:
242
diff
changeset
|
12 import tango.io.device.FileConduit; |
8d53428f9be0
Tango breaking change for new package tango.io.device
Frank Benoit <benoit@tionex.de>
parents:
242
diff
changeset
|
13 } else { |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
14 import tango.io.FileConduit; |
308
8d53428f9be0
Tango breaking change for new package tango.io.device
Frank Benoit <benoit@tionex.de>
parents:
242
diff
changeset
|
15 } |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
16 |
0 | 17 public class FileOutputStream : dwt.dwthelper.OutputStream.OutputStream { |
18 | |
19 alias dwt.dwthelper.OutputStream.OutputStream.write write; | |
20 alias dwt.dwthelper.OutputStream.OutputStream.close close; | |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
21 FileConduit fc; |
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
22 |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
0
diff
changeset
|
23 public this ( String name ){ |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
24 fc = new FileConduit( name, FileConduit.WriteCreate ); |
0 | 25 } |
26 | |
212
ab60f3309436
reverted the char[] to String and use the an alias.
Frank Benoit <benoit@tionex.de>
parents:
0
diff
changeset
|
27 public this ( String name, bool append ){ |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
28 fc = new FileConduit( name, append ? FileConduit.WriteAppending : FileConduit.WriteCreate ); |
0 | 29 } |
30 | |
31 public this ( dwt.dwthelper.File.File file ){ | |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
32 this( file.toString ); |
0 | 33 } |
34 | |
35 public this ( dwt.dwthelper.File.File file, bool append ){ | |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
36 this( file.toString, append ); |
0 | 37 } |
38 | |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
39 public override void write( int b ){ |
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
40 ubyte[1] a; |
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
41 a[0] = b & 0xFF; |
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
42 fc.write(a); |
0 | 43 } |
44 | |
242
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
45 public override void close(){ |
32a6819fef61
Fix implMissing for ImageLoader.save, thx yidabu for reporting.
Frank Benoit <benoit@tionex.de>
parents:
212
diff
changeset
|
46 fc.close(); |
0 | 47 } |
48 | |
49 public void finalize(){ | |
50 implMissing( __FILE__, __LINE__ ); | |
51 } | |
52 | |
53 | |
54 } | |
55 | |
56 |