| 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 |
* Port to the D programming language: |
|---|
| 11 |
* Frank Benoit <benoit@tionex.de> |
|---|
| 12 |
*******************************************************************************/ |
|---|
| 13 |
module dwt.internal.image.LEDataOutputStream; |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
import dwt.dwthelper.OutputStream; |
|---|
| 17 |
|
|---|
| 18 |
final class LEDataOutputStream : OutputStream { |
|---|
| 19 |
|
|---|
| 20 |
alias OutputStream.write write; |
|---|
| 21 |
|
|---|
| 22 |
OutputStream ostr; |
|---|
| 23 |
|
|---|
| 24 |
public this(OutputStream output) { |
|---|
| 25 |
this.ostr = output; |
|---|
| 26 |
} |
|---|
| 27 |
/** |
|---|
| 28 |
* Write the specified number of bytes of the given byte array, |
|---|
| 29 |
* starting at the specified offset, to the output stream. |
|---|
| 30 |
*/ |
|---|
| 31 |
public override void write(byte b[], int off, int len) { |
|---|
| 32 |
ostr.write(b, off, len); |
|---|
| 33 |
} |
|---|
| 34 |
/** |
|---|
| 35 |
* Write the given byte to the output stream. |
|---|
| 36 |
*/ |
|---|
| 37 |
public override void write(int b) { |
|---|
| 38 |
ostr.write(b); |
|---|
| 39 |
} |
|---|
| 40 |
/** |
|---|
| 41 |
* Write the given byte to the output stream. |
|---|
| 42 |
*/ |
|---|
| 43 |
public void writeByte(byte b) { |
|---|
| 44 |
ostr.write(b); |
|---|
| 45 |
} |
|---|
| 46 |
/** |
|---|
| 47 |
* Write the four bytes of the given integer |
|---|
| 48 |
* to the output stream. |
|---|
| 49 |
*/ |
|---|
| 50 |
public void writeInt(int theInt) { |
|---|
| 51 |
ostr.write(theInt & 0xFF); |
|---|
| 52 |
ostr.write((theInt >> 8) & 0xFF); |
|---|
| 53 |
ostr.write((theInt >> 16) & 0xFF); |
|---|
| 54 |
ostr.write((theInt >> 24) & 0xFF); |
|---|
| 55 |
} |
|---|
| 56 |
/** |
|---|
| 57 |
* Write the two bytes of the given short |
|---|
| 58 |
* to the output stream. |
|---|
| 59 |
*/ |
|---|
| 60 |
public void writeShort(int theShort) { |
|---|
| 61 |
ostr.write(theShort & 0xFF); |
|---|
| 62 |
ostr.write((theShort >> 8) & 0xFF); |
|---|
| 63 |
} |
|---|
| 64 |
} |
|---|