Mercurial > projects > dwt-mac
comparison dwt/internal/image/LEDataOutputStream.d @ 34:5123b17c98ef
Ported dwt.events.*, dwt.graphics.GC, Region, dwt.internal.image.*
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sun, 14 Sep 2008 01:45:57 +0200 |
parents | b903c16b6f48 |
children |
comparison
equal
deleted
inserted
replaced
33:965ac0a77267 | 34:5123b17c98ef |
---|---|
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
10 *******************************************************************************/ | 12 *******************************************************************************/ |
11 module dwt.internal.image; | 13 module dwt.internal.image.LEDataOutputStream; |
12 | 14 |
13 | 15 |
14 import java.io.IOException; | 16 import dwt.dwthelper.OutputStream; |
15 import java.io.OutputStream; | |
16 | 17 |
17 final class LEDataOutputStream : OutputStream { | 18 final class LEDataOutputStream : OutputStream { |
18 OutputStream out; | 19 |
20 alias OutputStream.write write; | |
21 | |
22 OutputStream ostr; | |
23 | |
19 public this(OutputStream output) { | 24 public this(OutputStream output) { |
20 this.out = output; | 25 this.ostr = output; |
21 } | 26 } |
22 /** | 27 /** |
23 * Write the specified number of bytes of the given byte array, | 28 * Write the specified number of bytes of the given byte array, |
24 * starting at the specified offset, to the output stream. | 29 * starting at the specified offset, to the output stream. |
25 */ | 30 */ |
26 public void write(byte b[], int off, int len) { | 31 public override void write(byte b[], int off, int len) { |
27 out.write(b, off, len); | 32 ostr.write(b, off, len); |
28 } | 33 } |
29 /** | 34 /** |
30 * Write the given byte to the output stream. | 35 * Write the given byte to the output stream. |
31 */ | 36 */ |
32 public void write(int b) { | 37 public override void write(int b) { |
33 out.write(b); | 38 ostr.write(b); |
34 } | 39 } |
35 /** | 40 /** |
36 * Write the given byte to the output stream. | 41 * Write the given byte to the output stream. |
37 */ | 42 */ |
38 public void writeByte(byte b) { | 43 public void writeByte(byte b) { |
39 out.write(b & 0xFF); | 44 ostr.write(b); |
40 } | 45 } |
41 /** | 46 /** |
42 * Write the four bytes of the given integer | 47 * Write the four bytes of the given integer |
43 * to the output stream. | 48 * to the output stream. |
44 */ | 49 */ |
45 public void writeInt(int theInt) { | 50 public void writeInt(int theInt) { |
46 out.write(theInt & 0xFF); | 51 ostr.write(theInt & 0xFF); |
47 out.write((theInt >> 8) & 0xFF); | 52 ostr.write((theInt >> 8) & 0xFF); |
48 out.write((theInt >> 16) & 0xFF); | 53 ostr.write((theInt >> 16) & 0xFF); |
49 out.write((theInt >> 24) & 0xFF); | 54 ostr.write((theInt >> 24) & 0xFF); |
50 } | 55 } |
51 /** | 56 /** |
52 * Write the two bytes of the given short | 57 * Write the two bytes of the given short |
53 * to the output stream. | 58 * to the output stream. |
54 */ | 59 */ |
55 public void writeShort(int theShort) { | 60 public void writeShort(int theShort) { |
56 out.write(theShort & 0xFF); | 61 ostr.write(theShort & 0xFF); |
57 out.write((theShort >> 8) & 0xFF); | 62 ostr.write((theShort >> 8) & 0xFF); |
58 } | 63 } |
59 } | 64 } |