12
|
1 /*******************************************************************************
|
|
2 * Copyright (c) 2000, 2005 IBM Corporation and others.
|
|
3 * All rights reserved. This program and the accompanying materials
|
|
4 * are made available under the terms of the Eclipse Public License v1.0
|
|
5 * which accompanies this distribution, and is available at
|
|
6 * http://www.eclipse.org/legal/epl-v10.html
|
|
7 *
|
|
8 * Contributors:
|
|
9 * IBM Corporation - initial API and implementation
|
|
10 *******************************************************************************/
|
|
11 module dwt.internal.image.LEDataOutputStream;
|
|
12
|
|
13
|
|
14 import dwt.dwthelper.OutputStream;
|
|
15
|
|
16 final class LEDataOutputStream : OutputStream {
|
13
|
17 alias OutputStream.write write;
|
12
|
18 OutputStream ostr;
|
|
19 public this(OutputStream output) {
|
|
20 this.ostr = output;
|
|
21 }
|
|
22 /**
|
|
23 * Write the specified number of bytes of the given byte array,
|
|
24 * starting at the specified offset, to the output stream.
|
|
25 */
|
|
26 public void write(byte b[], int off, int len) {
|
|
27 ostr.write(b, off, len);
|
|
28 }
|
|
29 /**
|
|
30 * Write the given byte to the output stream.
|
|
31 */
|
|
32 public void write(int b) {
|
|
33 ostr.write(b);
|
|
34 }
|
|
35 /**
|
|
36 * Write the given byte to the output stream.
|
|
37 */
|
|
38 public void writeByte(byte b) {
|
|
39 ostr.write(b);
|
|
40 }
|
|
41 /**
|
|
42 * Write the four bytes of the given integer
|
|
43 * to the output stream.
|
|
44 */
|
|
45 public void writeInt(int theInt) {
|
|
46 ostr.write(theInt & 0xFF);
|
|
47 ostr.write((theInt >> 8) & 0xFF);
|
|
48 ostr.write((theInt >> 16) & 0xFF);
|
|
49 ostr.write((theInt >> 24) & 0xFF);
|
|
50 }
|
|
51 /**
|
|
52 * Write the two bytes of the given short
|
|
53 * to the output stream.
|
|
54 */
|
|
55 public void writeShort(int theShort) {
|
|
56 ostr.write(theShort & 0xFF);
|
|
57 ostr.write((theShort >> 8) & 0xFF);
|
|
58 }
|
|
59 }
|