org.dcm4che2.io
Class DicomOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by org.dcm4che2.io.DicomOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class DicomOutputStream
extends java.io.FilterOutputStream


Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
DicomOutputStream(java.io.DataOutput dout)
          Use a DataOutput or ImageOutputStream as a destination.
DicomOutputStream(java.io.File f)
           
DicomOutputStream(java.io.OutputStream out)
           
DicomOutputStream(java.io.RandomAccessFile raf)
           
 
Method Summary
 void close()
           
 void finish()
          Finishes writing compressed data to the output stream without closing the underlying stream.
 byte[] getPreamble()
           
 long getStreamPosition()
           
 TransferSyntax getTransferSyntax()
           
 boolean isAutoFinish()
          Indicate if the stream is finished automatically (compressed data written) when the dataset is written
 boolean isExplicitItemLength()
           
 boolean isExplicitItemLengthIfZero()
           
 boolean isExplicitSequenceLength()
           
 boolean isExplicitSequenceLengthIfZero()
           
 boolean isIncludeGroupLength()
           
 void serializeDicomObject(DicomObject attrs)
          Only for internal use by DicomObjectSerializer.
 void setAutoFinish(boolean autoFinish)
          Set to false to not auto finish the stream on writing a data set - useful for writing a DataObject followed by some additonal DICOM that is custom written, eg images or related large data.
 void setExplicitItemLength(boolean explicitItemLength)
           
 void setExplicitItemLengthIfZero(boolean explicitItemLengthIfZero)
           
 void setExplicitSequenceLength(boolean explicitSequenceLength)
           
 void setExplicitSequenceLengthIfZero(boolean explicitSequenceLengthIfZero)
           
 void setIncludeGroupLength(boolean includeGroupLength)
           
 void setPreamble(byte[] preamble)
           
 void setStreamPosition(long pos)
           
 void setTransferSyntax(java.lang.String tsuid)
           
 void setTransferSyntax(TransferSyntax ts)
           
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 void writeCommand(DicomObject attrs)
           
 void writeDataset(DicomObject attrs, java.lang.String tsuid)
          Write a DICOM dataset to the output stream.
 void writeDataset(DicomObject attrs, TransferSyntax transferSyntax)
          Write a DICOM dataset to the output stream.
 void writeDicomFile(DicomObject attrs)
          Write a DICOM object to the output stream using the specified DicomObject to obtain the transfer syntax UID and other attributes.
 void writeFileMetaInformation(DicomObject attrs)
           
 void writeHeader(int tag, VR vr, int len)
           
 void writeItem(DicomObject item, TransferSyntax transferSyntax)
          Write an item (DicomObject) to the output stream.
 
Methods inherited from class java.io.FilterOutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DicomOutputStream

public DicomOutputStream(java.io.OutputStream out)

DicomOutputStream

public DicomOutputStream(java.io.File f)
                  throws java.io.IOException
Throws:
java.io.IOException

DicomOutputStream

public DicomOutputStream(java.io.RandomAccessFile raf)
                  throws java.io.IOException
Throws:
java.io.IOException

DicomOutputStream

public DicomOutputStream(java.io.DataOutput dout)
Use a DataOutput or ImageOutputStream as a destination.

Parameters:
dout - to send the dicom data to.
Method Detail

getPreamble

public byte[] getPreamble()

setPreamble

public void setPreamble(byte[] preamble)

getStreamPosition

public final long getStreamPosition()

setStreamPosition

public final void setStreamPosition(long pos)

getTransferSyntax

public final TransferSyntax getTransferSyntax()

setTransferSyntax

public final void setTransferSyntax(TransferSyntax ts)

setTransferSyntax

public final void setTransferSyntax(java.lang.String tsuid)

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

write

public void write(int b)
           throws java.io.IOException
Overrides:
write in class java.io.FilterOutputStream
Throws:
java.io.IOException

isExplicitItemLength

public final boolean isExplicitItemLength()

setExplicitItemLength

public final void setExplicitItemLength(boolean explicitItemLength)

isExplicitItemLengthIfZero

public final boolean isExplicitItemLengthIfZero()

setExplicitItemLengthIfZero

public final void setExplicitItemLengthIfZero(boolean explicitItemLengthIfZero)

isExplicitSequenceLength

public final boolean isExplicitSequenceLength()

setExplicitSequenceLength

public final void setExplicitSequenceLength(boolean explicitSequenceLength)

isExplicitSequenceLengthIfZero

public final boolean isExplicitSequenceLengthIfZero()

setExplicitSequenceLengthIfZero

public final void setExplicitSequenceLengthIfZero(boolean explicitSequenceLengthIfZero)

isIncludeGroupLength

public final boolean isIncludeGroupLength()

setIncludeGroupLength

public final void setIncludeGroupLength(boolean includeGroupLength)

serializeDicomObject

public void serializeDicomObject(DicomObject attrs)
                          throws java.io.IOException
Only for internal use by DicomObjectSerializer.

Throws:
java.io.IOException

writeCommand

public void writeCommand(DicomObject attrs)
                  throws java.io.IOException
Throws:
java.io.IOException

writeDicomFile

public void writeDicomFile(DicomObject attrs)
                    throws java.io.IOException
Write a DICOM object to the output stream using the specified DicomObject to obtain the transfer syntax UID and other attributes.

Parameters:
attrs - The DicomObject containing the DICOM tags to write into the file.
Throws:
java.io.IOException

writeFileMetaInformation

public void writeFileMetaInformation(DicomObject attrs)
                              throws java.io.IOException
Throws:
java.io.IOException

writeDataset

public void writeDataset(DicomObject attrs,
                         java.lang.String tsuid)
                  throws java.io.IOException
Write a DICOM dataset to the output stream.

Parameters:
attrs - A DicomObject containing the attributes to write.
tsuid - A String containing the transfer syntax UID of the file.
Throws:
java.io.IOException

writeDataset

public void writeDataset(DicomObject attrs,
                         TransferSyntax transferSyntax)
                  throws java.io.IOException
Write a DICOM dataset to the output stream.

Parameters:
attrs - A DicomObject containing the attributes to write.
transferSyntax - A TransferSyntax object representing the transfer syntax of the file.
Throws:
java.io.IOException

isAutoFinish

public boolean isAutoFinish()
Indicate if the stream is finished automatically (compressed data written) when the dataset is written


setAutoFinish

public void setAutoFinish(boolean autoFinish)
Set to false to not auto finish the stream on writing a data set - useful for writing a DataObject followed by some additonal DICOM that is custom written, eg images or related large data.

Parameters:
autoFinish -

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterOutputStream
Throws:
java.io.IOException

finish

public void finish()
            throws java.io.IOException
Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when applying multiple filters, and the transfer syntax is a deflator transfer syntax.

Throws:
java.io.IOException

writeItem

public void writeItem(DicomObject item,
                      TransferSyntax transferSyntax)
               throws java.io.IOException
Write an item (DicomObject) to the output stream.

Parameters:
item - The DicomObject containing the specific item to write.
transferSyntax - The TransferSyntax of the item.
Throws:
java.io.IOException

writeHeader

public void writeHeader(int tag,
                        VR vr,
                        int len)
                 throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2011 dcm4che. All Rights Reserved.