annotate base/src/java/io/FileOutputStream.d @ 119:d00e8db0a568

Spell error.
author Jacob Carlborg <doob@me.com>
date Sun, 17 Apr 2011 17:58:36 +0200
parents 1bf55a6eb092
children 536e43f63c81
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1 /**
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2 * Authors: Frank Benoit <keinfarbton@googlemail.com>
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 */
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4 module java.io.FileOutputStream;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
5
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
6 public import java.io.File;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 public import java.io.OutputStream;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
8
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 import java.lang.all;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
10
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
11 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
12 import TangoFile = tango.io.device.File;
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
13 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
14 static import std.file;
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
15 static import std.path;
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
16 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
17
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
18 public class FileOutputStream : java.io.OutputStream.OutputStream {
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
19
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
20 alias java.io.OutputStream.OutputStream.write write;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
21 alias java.io.OutputStream.OutputStream.close close;
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
22 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
23 TangoFile.File fc;
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
24 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
25 }
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
26
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
27 public this ( String name ){
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
28 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
29 fc = new TangoFile.File( name, TangoFile.File.WriteCreate );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
30 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
31 implMissing( __FILE__, __LINE__ );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
32 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 public this ( String name, bool append ){
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
36 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
37 fc = new TangoFile.File( name, append ? TangoFile.File.WriteAppending : TangoFile.File.WriteCreate );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
38 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
39 implMissing( __FILE__, __LINE__ );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
40 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43 public this ( java.io.File.File file ){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44 this( file.toString );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 public this ( java.io.File.File file, bool append ){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48 this( file.toString, append );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 public override void write( int b ){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 ubyte[1] a;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 a[0] = b & 0xFF;
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
54 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
55 fc.write(a);
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
56 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
57 implMissing( __FILE__, __LINE__ );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
58 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 public override void close(){
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
62 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
63 fc.close();
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
64 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
65 implMissing( __FILE__, __LINE__ );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 8
diff changeset
66 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
67 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
68
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
69 public void finalize(){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
70 implMissing( __FILE__, __LINE__ );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
72
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
73
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
74 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
75
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76