public class DicomInputStream extends FilterInputStream implements DicomInputHandler
| Modifier and Type | Class and Description |
|---|---|
static class |
DicomInputStream.IncludeBulkData |
in| Constructor and Description |
|---|
DicomInputStream(File file) |
DicomInputStream(InputStream in) |
DicomInputStream(InputStream in,
String tsuid) |
available, markSupportedprivate static final String UNEXPECTED_NON_ZERO_ITEM_LENGTH
private static final String UNEXPECTED_ATTRIBUTE
private static final String MISSING_TRANSFER_SYNTAX
private static final String MISSING_FMI_LENGTH
private static final String NOT_A_DICOM_STREAM
private static final String IMPLICIT_VR_BIG_ENDIAN
private static final String DEFLATED_WITH_ZLIB_HEADER
private static final int ZLIB_HEADER
private static final int DEF_ALLOCATE_LIMIT
private int allocateLimit
private byte[] preamble
private Attributes fileMetaInformation
private boolean hasfmi
private boolean bigEndian
private boolean explicitVR
private DicomInputStream.IncludeBulkData includeBulkData
private DicomInputStream.IncludeBulkData includeFragmentBulkData
private long pos
private long fmiEndPos
private long tagPos
private long markPos
private int tag
private int length
private DicomInputHandler handler
private BulkDataDescriptor bulkDataDescriptor
private final byte[] buffer
private ItemPointer[] itemPointers
private boolean decodeUNWithIVRLE
private boolean addBulkDataReferences
private boolean catBlkFiles
private String blkFilePrefix
private String blkFileSuffix
private File blkDirectory
private FileOutputStream blkOut
private long blkOutPos
public DicomInputStream(InputStream in, String tsuid) throws IOException
IOExceptionpublic DicomInputStream(InputStream in) throws IOException
IOExceptionpublic DicomInputStream(File file) throws IOException
IOExceptionpublic final String getTransferSyntax()
public final int getAllocateLimit()
setAllocateLimit(int)public final void setAllocateLimit(int allocateLimit)
DicomInputStream, the byte array is reallocated with
twice the previous length and filled again. That continues until
the twice of the previous length exceeds the actual value length. Then
the byte array is reallocated with actual value length and filled with
the remaining bytes for the value from this DicomInputStream.
The rational of the incrementing allocation of byte arrays is to avoid
OutOfMemoryErrors on parsing corrupted DICOM streams.
By default, the limit is set to 67108864 (64 MiB).allocateLimit - limit of initial allocated memory or -1 for no limitpublic final DicomInputStream.IncludeBulkData getIncludeBulkData()
public final void setIncludeBulkData(DicomInputStream.IncludeBulkData includeBulkData)
public final DicomInputStream.IncludeBulkData getIncludeFragmentBulkData()
public final BulkDataDescriptor getBulkDataDescriptor()
public final void setBulkDataDescriptor(BulkDataDescriptor bulkDataDescriptor)
public final String getBulkDataFilePrefix()
public final void setBulkDataFilePrefix(String blkFilePrefix)
public final String getBulkDataFileSuffix()
public final void setBulkDataFileSuffix(String blkFileSuffix)
public final File getBulkDataDirectory()
public final void setBulkDataDirectory(File blkDirectory)
public final boolean isConcatenateBulkDataFiles()
public final void setConcatenateBulkDataFiles(boolean catBlkFiles)
public final List<File> getBulkDataFiles()
public final void setDicomInputHandler(DicomInputHandler handler)
public boolean isDecodeUNWithIVRLE()
public void setDecodeUNWithIVRLE(boolean decodeUNWithIVRLE)
public boolean isAddBulkDataReferences()
public void setAddBulkDataReferences(boolean addBulkDataReferences)
public final void setFileMetaInformationGroupLength(byte[] val)
public final byte[] getPreamble()
public Attributes getFileMetaInformation() throws IOException
IOExceptionpublic final int level()
public final int tag()
public final int length()
public final long getPosition()
public void setPosition(long pos)
public long getTagPosition()
public final boolean bigEndian()
public final boolean explicitVR()
public void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterInputStreamIOExceptionpublic void mark(int readlimit)
mark in class FilterInputStreampublic void reset() throws IOException
reset in class FilterInputStreamIOExceptionpublic final int read() throws IOException
read in class FilterInputStreamIOExceptionpublic final int read(byte[] b, int off, int len) throws IOException
read in class FilterInputStreamIOExceptionpublic final int read(byte[] b) throws IOException
read in class FilterInputStreamIOExceptionpublic final long skip(long n) throws IOException
skip in class FilterInputStreamIOExceptionpublic void skipFully(long n) throws IOException
IOExceptionpublic void readFully(byte[] b) throws IOException
IOExceptionpublic void readFully(byte[] b, int off, int len) throws IOException
IOExceptionpublic int readHeader() throws IOException
IOExceptionpublic Attributes readCommand() throws IOException
IOExceptionpublic DatasetWithFMI readDatasetWithFMI() throws IOException
IOExceptionpublic DatasetWithFMI readDatasetWithFMI(int len, int stopTag) throws IOException
len - maximum length to read in bytes, use -1 for no limitstopTag - stop reading at the given Tag, use -1 for no stop tagIOExceptionpublic Attributes readDataset(int len, int stopTag) throws IOException
IOExceptionpublic Attributes readFileMetaInformation() throws IOException
IOExceptionpublic void readAttributes(Attributes attrs, int len, int stopTag) throws IOException
IOExceptionpublic void readValue(DicomInputStream dis, Attributes attrs) throws IOException
readValue in interface DicomInputHandlerIOExceptionpublic BulkData createBulkData() throws IOException
IOExceptionpublic boolean isBulkData(Attributes attrs)
public void readValue(DicomInputStream dis, Sequence seq) throws IOException
readValue in interface DicomInputHandlerIOExceptionpublic void readValue(DicomInputStream dis, Fragments frags) throws IOException
readValue in interface DicomInputHandlerIOExceptionpublic void startDataset(DicomInputStream dis)
startDataset in interface DicomInputHandlerpublic void endDataset(DicomInputStream dis)
endDataset in interface DicomInputHandlerprivate void checkIsThis(DicomInputStream dis)
private void skipAttribute(String message) throws IOException
IOExceptionprivate void readSequence(int len, Attributes attrs, int sqtag) throws IOException
IOExceptionpublic Attributes readItem() throws IOException
IOExceptionprivate void readFragments(Attributes attrs, int fragsTag, VR vr) throws IOException
IOExceptionpublic byte[] readValue() throws IOException
IOExceptionprivate void switchTransferSyntax(String tsuid) throws IOException
IOExceptionprivate boolean hasZLIBHeader() throws IOException
IOExceptionprivate void guessTransferSyntax() throws IOException
IOExceptionprivate boolean guessTransferSyntax(byte[] b128, int rlen, boolean bigEndian) throws DicomStreamException
DicomStreamExceptionCopyright © 2017 dcm4che.org. All rights reserved.