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