annotate base/src/java/io/ByteArrayOutputStream.d @ 112:9f4c18c268b2

Update to compile and execute with dmd 2.052.
author kntroh
date Wed, 16 Mar 2011 21:53:53 +0900
parents e944a4cf537b
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.ByteArrayOutputStream;
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.OutputStream;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 import java.lang.all;
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
8
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
9 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
10 import tango.io.device.Array;
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
11 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
12 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
13
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
14 public class ByteArrayOutputStream : java.io.OutputStream.OutputStream {
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
15
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
16 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
17 protected Array buffer;
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
18 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
19 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
20
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
21 public this (){
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
22 version(Tango){
107
e944a4cf537b Updated to dmd 1.063 and Tango trunk.
Jacob Carlborg <doob@me.com>
parents: 27
diff changeset
23 buffer = new Array(0);
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
24 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
25 implMissing( __FILE__, __LINE__ );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
26 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
27 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
28
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
29 public this ( int par_size ){
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
30 version(Tango){
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
31 buffer = new Array(par_size);
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
32 } else { // Phobos
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
33 implMissing( __FILE__, __LINE__ );
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
34 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36
112
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
37 public override void write( int b ){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
38 synchronized {
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
39 version(Tango){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
40 byte[1] a;
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
41 a[0] = b & 0xFF;
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
42 buffer.append(a);
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
43 } else { // Phobos
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
44 implMissing( __FILE__, __LINE__ );
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
45 }
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
46 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48
112
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
49 public override void write( byte[] b, int off, int len ){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
50 synchronized {
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
51 version(Tango){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
52 buffer.append( b[ off .. off + len ]);
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
53 } else { // Phobos
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
54 implMissing( __FILE__, __LINE__ );
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
55 }
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
56 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58
112
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
59 public override void write( byte[] b ){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
60 synchronized {
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
61 version(Tango){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
62 buffer.append( b );
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
63 } else { // Phobos
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
64 implMissing( __FILE__, __LINE__ );
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
65 }
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
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
112
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
69 public void writeTo( java.io.OutputStream.OutputStream out_KEYWORDESCAPE ){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
70 synchronized
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
71 implMissing( __FILE__, __LINE__ );
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
112
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
74 public void reset(){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
75 synchronized
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
76 implMissing( __FILE__, __LINE__ );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
77 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
78
112
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
79 public byte[] toByteArray(){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
80 synchronized {
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
81 version(Tango){
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
82 return cast(byte[])buffer.slice();
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
83 } else { // Phobos
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
84 implMissing( __FILE__, __LINE__ );
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
85 return null;
9f4c18c268b2 Update to compile and execute with dmd 2.052.
kntroh
parents: 107
diff changeset
86 }
21
9b96950f2c3c the 'java' tree compiles on both D1-Tango and D2-Phobos
Frank Benoit <benoit@tionex.de>
parents: 0
diff changeset
87 }
0
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
88 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
89
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
90 public int size(){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
91 implMissing( __FILE__, __LINE__ );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
92 return 0;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
93 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
94
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
95 public override String toString(){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
96 implMissing( __FILE__, __LINE__ );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
97 return null;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
98 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
99
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
100 public String toString( String enc ){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
101 implMissing( __FILE__, __LINE__ );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
102 return null;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
103 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
104
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
105 public String toString( int hibyte ){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
106 implMissing( __FILE__, __LINE__ );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
107 return null;
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
108 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
109
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
110 public override void close(){
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
111 implMissing( __FILE__, __LINE__ );
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
112 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
113 }
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
114
6dd524f61e62 add dwt win and basic java stuff
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
115