KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > swt > internal > image > LEDataOutputStream


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 package org.eclipse.swt.internal.image;
12
13
14 import java.io.*;
15
16 final class LEDataOutputStream extends OutputStream {
17     OutputStream out;
18 public LEDataOutputStream(OutputStream output) {
19     this.out = output;
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  * Write the given byte to the output stream.
30  */

31 public void write(int b) throws IOException {
32     out.write(b);
33 }
34 /**
35  * Write the given byte to the output stream.
36  */

37 public void writeByte(byte b) throws IOException {
38     out.write(b & 0xFF);
39 }
40 /**
41  * Write the four bytes of the given integer
42  * to the output stream.
43  */

44 public void writeInt(int theInt) throws IOException {
45     out.write(theInt & 0xFF);
46     out.write((theInt >> 8) & 0xFF);
47     out.write((theInt >> 16) & 0xFF);
48     out.write((theInt >> 24) & 0xFF);
49 }
50 /**
51  * Write the two bytes of the given short
52  * to the output stream.
53  */

54 public void writeShort(int theShort) throws IOException {
55     out.write(theShort & 0xFF);
56     out.write((theShort >> 8) & 0xFF);
57 }
58 }
59
Popular Tags