Changeset 242:32a6819fef61
- Timestamp:
- 06/24/08 16:05:28
(2 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- Children:
243:ecb80b2a89e1 248:d10ff1f47f84
- branch:
- default
- Message:
Fix implMissing for ImageLoader?.save, thx yidabu for reporting.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r212 |
r242 |
|
| 6 | 6 | public import dwt.dwthelper.OutputStream; |
|---|
| 7 | 7 | import dwt.dwthelper.utils; |
|---|
| | 8 | import tango.io.GrowBuffer; |
|---|
| 8 | 9 | |
|---|
| 9 | 10 | public class ByteArrayOutputStream : dwt.dwthelper.OutputStream.OutputStream { |
|---|
| 10 | 11 | |
|---|
| 11 | | alias dwt.dwthelper.OutputStream.OutputStream.write write; |
|---|
| | 12 | protected GrowBuffer buffer; |
|---|
| 12 | 13 | |
|---|
| 13 | | protected byte[] buf; |
|---|
| 14 | | protected int count; |
|---|
| 15 | 14 | public this (){ |
|---|
| | 15 | buffer = new GrowBuffer(); |
|---|
| 16 | 16 | } |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | public this ( int par_size ){ |
|---|
| | 19 | buffer = new GrowBuffer(par_size); |
|---|
| 19 | 20 | } |
|---|
| 20 | 21 | |
|---|
| 21 | | public synchronized void write( int b ){ |
|---|
| 22 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 22 | public synchronized override void write( int b ){ |
|---|
| | 23 | byte[1] a; |
|---|
| | 24 | a[0] = b & 0xFF; |
|---|
| | 25 | buffer.append(a); |
|---|
| 23 | 26 | } |
|---|
| 24 | 27 | |
|---|
| 25 | | public synchronized void write( byte[] b, int off, int len ){ |
|---|
| 26 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 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 ); |
|---|
| 27 | 34 | } |
|---|
| 28 | 35 | |
|---|
| … | … | |
| 36 | 43 | |
|---|
| 37 | 44 | public synchronized byte[] toByteArray(){ |
|---|
| 38 | | implMissing( __FILE__, __LINE__ ); |
|---|
| 39 | | return null; |
|---|
| | 45 | return cast(byte[])buffer.slice(); |
|---|
| 40 | 46 | } |
|---|
| 41 | 47 | |
|---|
| … | … | |
| 63 | 69 | implMissing( __FILE__, __LINE__ ); |
|---|
| 64 | 70 | } |
|---|
| 65 | | |
|---|
| 66 | | |
|---|
| 67 | 71 | } |
|---|
| 68 | 72 | |
|---|
| r212 |
r242 |
|
| 9 | 9 | import dwt.dwthelper.utils; |
|---|
| 10 | 10 | |
|---|
| | 11 | import tango.io.FileConduit; |
|---|
| | 12 | |
|---|
| 11 | 13 | public class FileOutputStream : dwt.dwthelper.OutputStream.OutputStream { |
|---|
| 12 | 14 | |
|---|
| 13 | 15 | alias dwt.dwthelper.OutputStream.OutputStream.write write; |
|---|
| 14 | 16 | alias dwt.dwthelper.OutputStream.OutputStream.close close; |
|---|
| 15 | | |
|---|
| | 17 | FileConduit fc; |
|---|
| | 18 | |
|---|
| 16 | 19 | public this ( String name ){ |
|---|
| 17 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 20 | fc = new FileConduit( name, FileConduit.WriteCreate ); |
|---|
| 18 | 21 | } |
|---|
| 19 | 22 | |
|---|
| 20 | 23 | public this ( String name, bool append ){ |
|---|
| 21 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 24 | fc = new FileConduit( name, append ? FileConduit.WriteAppending : FileConduit.WriteCreate ); |
|---|
| 22 | 25 | } |
|---|
| 23 | 26 | |
|---|
| 24 | 27 | public this ( dwt.dwthelper.File.File file ){ |
|---|
| 25 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 28 | this( file.toString ); |
|---|
| 26 | 29 | } |
|---|
| 27 | 30 | |
|---|
| 28 | 31 | public this ( dwt.dwthelper.File.File file, bool append ){ |
|---|
| 29 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 32 | this( file.toString, append ); |
|---|
| 30 | 33 | } |
|---|
| 31 | 34 | |
|---|
| 32 | | public void write( int b ){ |
|---|
| 33 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 35 | public override void write( int b ){ |
|---|
| | 36 | ubyte[1] a; |
|---|
| | 37 | a[0] = b & 0xFF; |
|---|
| | 38 | fc.write(a); |
|---|
| 34 | 39 | } |
|---|
| 35 | 40 | |
|---|
| 36 | | public void write( byte[] b ){ |
|---|
| 37 | | implMissing( __FILE__, __LINE__ ); |
|---|
| 38 | | } |
|---|
| 39 | | |
|---|
| 40 | | public void write( byte[] b, int off, int len ){ |
|---|
| 41 | | implMissing( __FILE__, __LINE__ ); |
|---|
| 42 | | } |
|---|
| 43 | | |
|---|
| 44 | | public void close(){ |
|---|
| 45 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 41 | public override void close(){ |
|---|
| | 42 | fc.close(); |
|---|
| 46 | 43 | } |
|---|
| 47 | 44 | |
|---|
| r212 |
r242 |
|
| 5 | 5 | |
|---|
| 6 | 6 | import dwt.dwthelper.utils; |
|---|
| 7 | | static import tango.io.model.IConduit; |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | public abstract class OutputStream { |
|---|
| 10 | 9 | |
|---|
| 11 | | private tango.io.model.IConduit.OutputStream ostr; |
|---|
| 12 | | |
|---|
| 13 | 10 | public this(){ |
|---|
| 14 | | } |
|---|
| 15 | | |
|---|
| 16 | | protected this( tango.io.model.IConduit.OutputStream aOutStream) { |
|---|
| 17 | | this.ostr = aOutStream; |
|---|
| 18 | | } |
|---|
| 19 | | |
|---|
| 20 | | protected this(OutputStream rhs) { |
|---|
| 21 | | ostr = rhs.ostr; |
|---|
| 22 | 11 | } |
|---|
| 23 | 12 | |
|---|
| … | … | |
| 25 | 14 | |
|---|
| 26 | 15 | public void write( byte[] b ){ |
|---|
| 27 | | ostr.write(b); |
|---|
| 28 | | } |
|---|
| 29 | | |
|---|
| 30 | | public void write(String c) { |
|---|
| 31 | | ostr.write(c); |
|---|
| | 16 | foreach( bv; b ){ |
|---|
| | 17 | write(bv); |
|---|
| | 18 | } |
|---|
| 32 | 19 | } |
|---|
| 33 | 20 | |
|---|
| 34 | 21 | public void write( byte[] b, int off, int len ){ |
|---|
| 35 | | implMissing( __FILE__, __LINE__ ); |
|---|
| | 22 | write(b[off .. off+len]); |
|---|
| 36 | 23 | } |
|---|
| 37 | 24 | |
|---|
| 38 | 25 | public void flush(){ |
|---|
| 39 | | ostr.flush(); |
|---|
| 40 | 26 | } |
|---|
| 41 | 27 | |
|---|
| 42 | 28 | public void close(){ |
|---|
| 43 | | ostr.flush(); |
|---|
| 44 | | implMissing( __FILE__, __LINE__ ); |
|---|
| 45 | 29 | } |
|---|
| 46 | | |
|---|
| 47 | | |
|---|
| 48 | 30 | } |
|---|
| 49 | 31 | |
|---|