| 1 |
/** |
|---|
| 2 |
* Authors: Frank Benoit <keinfarbton@googlemail.com> |
|---|
| 3 |
*/ |
|---|
| 4 |
module dwt.dwthelper.ByteArrayOutputStream; |
|---|
| 5 |
|
|---|
| 6 |
public import dwt.dwthelper.OutputStream; |
|---|
| 7 |
import dwt.dwthelper.utils; |
|---|
| 8 |
import tango.io.Buffer; |
|---|
| 9 |
|
|---|
| 10 |
public class ByteArrayOutputStream : dwt.dwthelper.OutputStream.OutputStream { |
|---|
| 11 |
|
|---|
| 12 |
protected GrowBuffer buffer; |
|---|
| 13 |
|
|---|
| 14 |
public this (){ |
|---|
| 15 |
buffer = new GrowBuffer(); |
|---|
| 16 |
} |
|---|
| 17 |
|
|---|
| 18 |
public this ( int par_size ){ |
|---|
| 19 |
buffer = new GrowBuffer(par_size); |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
public synchronized override void write( int b ){ |
|---|
| 23 |
byte[1] a; |
|---|
| 24 |
a[0] = b & 0xFF; |
|---|
| 25 |
buffer.append(a); |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
public synchronized override void write( byte[] b, int off, int len ){ |
|---|
| 29 |
buffer.append( b[ off .. off + len ]); |
|---|
| 30 |
} |
|---|
| 31 |
|
|---|
| 32 |
public synchronized override void write( byte[] b ){ |
|---|
| 33 |
buffer.append( b ); |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
public synchronized void writeTo( dwt.dwthelper.OutputStream.OutputStream out_KEYWORDESCAPE ){ |
|---|
| 37 |
implMissing( __FILE__, __LINE__ ); |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
public synchronized void reset(){ |
|---|
| 41 |
implMissing( __FILE__, __LINE__ ); |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
public synchronized byte[] toByteArray(){ |
|---|
| 45 |
return cast(byte[])buffer.slice(); |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
public int size(){ |
|---|
| 49 |
implMissing( __FILE__, __LINE__ ); |
|---|
| 50 |
return 0; |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
public override String toString(){ |
|---|
| 54 |
implMissing( __FILE__, __LINE__ ); |
|---|
| 55 |
return null; |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
public String toString( String enc ){ |
|---|
| 59 |
implMissing( __FILE__, __LINE__ ); |
|---|
| 60 |
return null; |
|---|
| 61 |
} |
|---|
| 62 |
|
|---|
| 63 |
public String toString( int hibyte ){ |
|---|
| 64 |
implMissing( __FILE__, __LINE__ ); |
|---|
| 65 |
return null; |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
public override void close(){ |
|---|
| 69 |
implMissing( __FILE__, __LINE__ ); |
|---|
| 70 |
} |
|---|
| 71 |
} |
|---|