Mercurial > projects > dwt-linux
view dwt/dwthelper/ByteArrayOutputStream.d @ 262:e10de397beb1
ADD version TANGOSVN
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jul 2008 15:33:12 +0200 |
parents | cc1d3de0e80b |
children | d472fae79005 |
line wrap: on
line source
/** * Authors: Frank Benoit <keinfarbton@googlemail.com> */ module dwt.dwthelper.ByteArrayOutputStream; public import dwt.dwthelper.OutputStream; import dwt.dwthelper.utils; import tango.io.Buffer; version(TANGOSVN) import tango.io.Buffer; } else{ import tango.io.GrowBuffer; } public class ByteArrayOutputStream : dwt.dwthelper.OutputStream.OutputStream { protected GrowBuffer buffer; public this (){ buffer = new GrowBuffer(); } public this ( int par_size ){ buffer = new GrowBuffer(par_size); } public synchronized override void write( int b ){ byte[1] a; a[0] = b & 0xFF; buffer.append(a); } public synchronized override void write( byte[] b, int off, int len ){ buffer.append( b[ off .. off + len ]); } public synchronized override void write( byte[] b ){ buffer.append( b ); } public synchronized void writeTo( dwt.dwthelper.OutputStream.OutputStream out_KEYWORDESCAPE ){ implMissing( __FILE__, __LINE__ ); } public synchronized void reset(){ implMissing( __FILE__, __LINE__ ); } public synchronized byte[] toByteArray(){ return cast(byte[])buffer.slice(); } public int size(){ implMissing( __FILE__, __LINE__ ); return 0; } public override String toString(){ implMissing( __FILE__, __LINE__ ); return null; } public String toString( String enc ){ implMissing( __FILE__, __LINE__ ); return null; } public String toString( int hibyte ){ implMissing( __FILE__, __LINE__ ); return null; } public override void close(){ implMissing( __FILE__, __LINE__ ); } }