public class DicomOutputStream extends BinaryOutputStream
A class that extends BinaryOutputStream
by adding
the concept of transfer syntaxes, for a (possible) meta information header and a data set.
Note this class does not automatically switch from meta information header to data set
transfer syntaxes. That is the responsibility of the caller writing the individual attributes
(such as by reaching the end of the meta information group length, and then calling
setWritingDataSet()
.
AttributeList
,
DicomInputStream
byteOffset
Constructor and Description |
---|
DicomOutputStream(java.io.OutputStream o,
java.lang.String metaTransferSyntaxUID,
java.lang.String dataTransferSyntaxUID)
Construct a stream to write DICOM data sets to the supplied stream.
|
DicomOutputStream(java.io.OutputStream o,
java.lang.String metaTransferSyntaxUID,
java.lang.String dataTransferSyntaxUID,
byte[] preamble)
Construct a stream to write DICOM data sets to the supplied stream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
areWritingDataSet()
Are we writing the dataset?
|
boolean |
areWritingMetaHeader()
Are we writing the meta information header?
|
long |
getByteOffsetOfStartOfData()
Get the byte offset of the start of the dataset or meta information header.
|
TransferSyntax |
getTransferSyntaxInUse()
Get the transfer syntax currently in use.
|
TransferSyntax |
getTransferSyntaxToWriteDataSet()
Get the transfer syntax to be used for writing the data set.
|
TransferSyntax |
getTransferSyntaxToWriteMetaHeader()
Get the transfer syntax to be used for writing the meta information header.
|
boolean |
haveMetaHeader()
Will we be writing a meta information header?
|
boolean |
isExplicitVR()
Is the transfer syntax currently in use explicit VR ?
|
boolean |
isImplicitVR()
Is the transfer syntax currently in use implicit VR ?
|
void |
setTransferSyntaxToWriteDataSet(TransferSyntax ts)
Specify what transfer syntax to use when switching from writing
the meta information header to writing the data set.
|
void |
setWritingDataSet()
Switch to the transfer syntax for writing the dataset.
|
void |
setWritingMetaHeader()
Switch to the transfer syntax for writing the meta information header.
|
getByteOffset, isBigEndian, isLittleEndian, localInit, main, setBigEndian, setEndian, setLittleEndian, write, write, write, writeDouble, writeDouble, writeFloat, writeFloat, writeSigned16, writeSigned32, writeSigned64, writeUnsigned16, writeUnsigned16, writeUnsigned32, writeUnsigned32, writeUnsigned64, writeUnsigned64, writeUnsigned8
public DicomOutputStream(java.io.OutputStream o, java.lang.String metaTransferSyntaxUID, java.lang.String dataTransferSyntaxUID) throws java.io.IOException
Construct a stream to write DICOM data sets to the supplied stream.
If the metaTransferSyntaxUID is not null, a 128 byte preamble of all zeroes plus "DICM" will also be written.
o
- the output stream to write tometaTransferSyntaxUID
- use this transfer syntax for the meta information header (may be null)dataTransferSyntaxUID
- use this transfer syntax for the data setjava.io.IOException
- if an I/O error occurspublic DicomOutputStream(java.io.OutputStream o, java.lang.String metaTransferSyntaxUID, java.lang.String dataTransferSyntaxUID, byte[] preamble) throws java.io.IOException
Construct a stream to write DICOM data sets to the supplied stream.
If the metaTransferSyntaxUID is not null, a 128 byte preamble plus "DICM" will also be written.
o
- the output stream to write tometaTransferSyntaxUID
- use this transfer syntax for the meta information header (may be null)dataTransferSyntaxUID
- use this transfer syntax for the data setpreamble
- 128 bytes to use as preamble, otherwise null to use default of all zero bytesjava.io.IOException
- if an I/O error occurspublic boolean areWritingDataSet()
Are we writing the dataset?
public boolean areWritingMetaHeader()
Are we writing the meta information header?
public long getByteOffsetOfStartOfData()
Get the byte offset of the start of the dataset or meta information header.
Will be 0 if no preamble, 132 if a preamble.
public TransferSyntax getTransferSyntaxInUse()
Get the transfer syntax currently in use.
public TransferSyntax getTransferSyntaxToWriteDataSet()
Get the transfer syntax to be used for writing the data set.
public TransferSyntax getTransferSyntaxToWriteMetaHeader()
Get the transfer syntax to be used for writing the meta information header.
public boolean haveMetaHeader()
Will we be writing a meta information header?
public boolean isExplicitVR()
Is the transfer syntax currently in use explicit VR ?
public boolean isImplicitVR()
Is the transfer syntax currently in use implicit VR ?
public void setTransferSyntaxToWriteDataSet(TransferSyntax ts)
Specify what transfer syntax to use when switching from writing the meta information header to writing the data set.
ts
- transfer syntax to use for data setpublic void setWritingDataSet()
Switch to the transfer syntax for writing the dataset.
public void setWritingMetaHeader()
Switch to the transfer syntax for writing the meta information header.