Mercurial > projects > dwt-win
annotate dwt/internal/image/LEDataOutputStream.d @ 213:36f5cb12e1a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 17 May 2008 17:34:28 +0200 |
parents | 9a64a7781bab |
children |
rev | line source |
---|---|
213 | 1 /******************************************************************************* |
2
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
2 * Copyright (c) 2000, 2005 IBM Corporation and others. |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
3 * All rights reserved. This program and the accompanying materials |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
4 * are made available under the terms of the Eclipse Public License v1.0 |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
5 * which accompanies this distribution, and is available at |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
6 * http://www.eclipse.org/legal/epl-v10.html |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
7 * |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
8 * Contributors: |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
9 * IBM Corporation - initial API and implementation |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
10 * Port to the D programming language: |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
11 * Frank Benoit <benoit@tionex.de> |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
12 *******************************************************************************/ |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
13 module dwt.internal.image.LEDataOutputStream; |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
14 |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
15 |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
16 import dwt.dwthelper.OutputStream; |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
17 |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
18 final class LEDataOutputStream : OutputStream { |
213 | 19 |
2
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
20 alias OutputStream.write write; |
213 | 21 |
2
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
22 OutputStream ostr; |
213 | 23 |
2
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
24 public this(OutputStream output) { |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
25 this.ostr = output; |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
26 } |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
27 /** |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
28 * Write the specified number of bytes of the given byte array, |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
29 * starting at the specified offset, to the output stream. |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
30 */ |
213 | 31 public override void write(byte b[], int off, int len) { |
2
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
32 ostr.write(b, off, len); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
33 } |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
34 /** |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
35 * Write the given byte to the output stream. |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
36 */ |
213 | 37 public override void write(int b) { |
2
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
38 ostr.write(b); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
39 } |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
40 /** |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
41 * Write the given byte to the output stream. |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
42 */ |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
43 public void writeByte(byte b) { |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
44 ostr.write(b); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
45 } |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
46 /** |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
47 * Write the four bytes of the given integer |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
48 * to the output stream. |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
49 */ |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
50 public void writeInt(int theInt) { |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
51 ostr.write(theInt & 0xFF); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
52 ostr.write((theInt >> 8) & 0xFF); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
53 ostr.write((theInt >> 16) & 0xFF); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
54 ostr.write((theInt >> 24) & 0xFF); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
55 } |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
56 /** |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
57 * Write the two bytes of the given short |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
58 * to the output stream. |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
59 */ |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
60 public void writeShort(int theShort) { |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
61 ostr.write(theShort & 0xFF); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
62 ostr.write((theShort >> 8) & 0xFF); |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
63 } |
57151e2793a2
More common modules from dwt-linux
Frank Benoit <benoit@tionex.de>
parents:
diff
changeset
|
64 } |