|
Revision 308:8d53428f9be0, 1.2 kB
(checked in by Frank Benoit <benoit@tionex.de>, 3 months ago)
|
Tango breaking change for new package tango.io.device
|
| Line | |
|---|
| 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 |
|
|---|
| 11 |
version(TANGOSVN){ |
|---|
| 12 |
import tango.io.device.FileConduit; |
|---|
| 13 |
} else { |
|---|
| 14 |
import tango.io.FileConduit; |
|---|
| 15 |
} |
|---|
| 16 |
|
|---|
| 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; |
|---|
| 21 |
FileConduit fc; |
|---|
| 22 |
|
|---|
| 23 |
public this ( String name ){ |
|---|
| 24 |
fc = new FileConduit( name, FileConduit.WriteCreate ); |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
public this ( String name, bool append ){ |
|---|
| 28 |
fc = new FileConduit( name, append ? FileConduit.WriteAppending : FileConduit.WriteCreate ); |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
public this ( dwt.dwthelper.File.File file ){ |
|---|
| 32 |
this( file.toString ); |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
public this ( dwt.dwthelper.File.File file, bool append ){ |
|---|
| 36 |
this( file.toString, append ); |
|---|
| 37 |
} |
|---|
| 38 |
|
|---|
| 39 |
public override void write( int b ){ |
|---|
| 40 |
ubyte[1] a; |
|---|
| 41 |
a[0] = b & 0xFF; |
|---|
| 42 |
fc.write(a); |
|---|
| 43 |
} |
|---|
| 44 |
|
|---|
| 45 |
public override void close(){ |
|---|
| 46 |
fc.close(); |
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
public void finalize(){ |
|---|
| 50 |
implMissing( __FILE__, __LINE__ ); |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
} |
|---|