org.dicom4j.io
Class BinaryOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.dicom4j.io.BinaryOutputStream
All Implemented Interfaces:
Closeable, Flushable
Direct Known Subclasses:
DicomOutputStream

public class BinaryOutputStream
extends FilterOutputStream

Extends FilterOutputStream by adding the concept of little and big endian binary value encoding. Supplies functions for writing various sized integer and floating point words.

Since:
0.0.0
Author:
Laurent Lecomte

Constructor Summary
BinaryOutputStream(OutputStream aStream)
           
BinaryOutputStream(OutputStream aStream, ByteOrder aByteOrder)
          Create a new BinaryOutputStream
 
Method Summary
 ByteOrder getByteOrder()
           
 void setByteOrder(ByteOrder aValue)
           
 void writeASCII(String aValue)
           
 void writeBoolean(boolean aValue)
           
 void writeDouble(double value)
           Write one floating point 64 bit value.
 void writeDouble(double[] f, int len)
           Write an array of floating point 64 bit values.
 void writeFloat(float value)
           Write one floating point 32 bit value.
 void writeFloat(float[] f, int len)
           Write an array of floating point 32 bit values.
 void writeSigned16(int v)
           Write one signed integer 16 bit value.
 void writeSigned32(long v)
           Write one signed integer 32 bit value.
 void writeUnsigned16(int aUnsigned16)
           Write an unsigned integer 16 bits long value.
 void writeUnsigned16(short[] w, int len)
           Write an array of unsigned integer 16 bit values.
 void writeUnsigned32(long v)
           Write one unsigned integer 32 bit value.
 void writeUnsigned8(int aUnsigned8)
           Write an unsigned integer 8 bits long value.
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryOutputStream

public BinaryOutputStream(OutputStream aStream)

BinaryOutputStream

public BinaryOutputStream(OutputStream aStream,
                          ByteOrder aByteOrder)
Create a new BinaryOutputStream

Parameters:
aStream - The underlying output stream
aByteOrder - The byteOrder to use
Method Detail

getByteOrder

public ByteOrder getByteOrder()

setByteOrder

public void setByteOrder(ByteOrder aValue)

writeASCII

public void writeASCII(String aValue)
                throws IOException
Throws:
IOException

writeBoolean

public void writeBoolean(boolean aValue)
                  throws IOException
Throws:
IOException

writeDouble

public final void writeDouble(double value)
                       throws IOException

Write one floating point 64 bit value.

Parameters:
value - a double value
Throws:
IOException

writeDouble

public final void writeDouble(double[] f,
                              int len)
                       throws IOException

Write an array of floating point 64 bit values.

Parameters:
f - an array of floats to write
len - the number of values to write
Throws:
IOException

writeFloat

public final void writeFloat(float value)
                      throws IOException

Write one floating point 32 bit value.

Parameters:
value - a float value
Throws:
IOException

writeFloat

public final void writeFloat(float[] f,
                             int len)
                      throws IOException

Write an array of floating point 32 bit values.

Parameters:
f - an array of floats to write
len - the number of values to write
Throws:
IOException

writeSigned16

public final void writeSigned16(int v)
                         throws IOException

Write one signed integer 16 bit value.

Parameters:
v - an int containing an signed value
Throws:
IOException

writeSigned32

public final void writeSigned32(long v)
                         throws IOException

Write one signed integer 32 bit value.

Parameters:
v - a long containing an signed value
Throws:
IOException

writeUnsigned16

public final void writeUnsigned16(int aUnsigned16)
                           throws IOException

Write an unsigned integer 16 bits long value.

Parameters:
aUnsigned16 - An int containing an unsigned value (0 <= aUnsigned16 < 2^16)
Throws:
IOException

writeUnsigned16

public final void writeUnsigned16(short[] w,
                                  int len)
                           throws IOException

Write an array of unsigned integer 16 bit values.

Parameters:
w - an array of integers to write
len - the number of 16 bit values to write
Throws:
IOException

writeUnsigned32

public final void writeUnsigned32(long v)
                           throws IOException

Write one unsigned integer 32 bit value.

Parameters:
v - a long containing an unsigned value
Throws:
IOException

writeUnsigned8

public final void writeUnsigned8(int aUnsigned8)
                          throws IOException

Write an unsigned integer 8 bits long value.

Parameters:
aUnsigned8 - An int containing an unsigned value (0 <= aUnsigned16 < 2^16)
Throws:
IOException


Copyright © 2009 dicom4j. All Rights Reserved.