org.dcm4che2.io
Class DicomInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.dcm4che2.io.DicomInputStream
All Implemented Interfaces:
java.io.Closeable, DicomInputHandler

public class DicomInputStream
extends java.io.FilterInputStream
implements DicomInputHandler


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
DicomInputStream(java.io.File f)
           
DicomInputStream(javax.imageio.stream.ImageInputStream iis)
           
DicomInputStream(javax.imageio.stream.ImageInputStream iis, TransferSyntax ts)
           
DicomInputStream(java.io.InputStream in)
           
DicomInputStream(java.io.InputStream in, java.lang.String tsuid)
           
DicomInputStream(java.io.InputStream in, TransferSyntax ts)
           
DicomInputStream(java.io.RandomAccessFile raf)
           
DicomInputStream(java.io.RandomAccessFile raf, TransferSyntax ts)
           
 
Method Summary
 DicomObject getDicomObject()
           
 long getEndOfFileMetaInfoPosition()
           
 byte[] getPreamble()
           
 long getStreamPosition()
           
 TransferSyntax getTransferSyntax()
           
 int level()
           
 void mark(int readlimit)
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 byte[] readBytes(int vallen)
           
 DicomObject readDicomObject()
           
 void readDicomObject(DicomObject dest, int len)
           
 DicomObject readFileMetaInformation()
          Read File Meta Information from this stream.
 void readFileMetaInformation(DicomObject dest)
          Read File Meta Information from this stream into DicomObject.
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readHeader()
           
 void readItem(DicomObject dest)
           
 void readItems(DicomElement sq, int sqlen)
           
 boolean readValue(DicomInputStream dis)
          Called by the input stream when reading a DICOM value in the stream.
 void reset()
           
 void setEndOfFileMetaInfoPosition(long fmiEndPos)
           
 void setHandler(DicomInputHandler handler)
           
 void setStreamPosition(long pos)
           
 long skip(long n)
           
 void skipFully(long len)
           
 DicomElement sq()
           
 int tag()
           
 long tagPosition()
           
 int valueLength()
           
 VR vr()
           
 
Methods inherited from class java.io.FilterInputStream
available, close, markSupported, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DicomInputStream

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

DicomInputStream

public DicomInputStream(java.io.RandomAccessFile raf,
                        TransferSyntax ts)
                 throws java.io.IOException
Throws:
java.io.IOException

DicomInputStream

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

DicomInputStream

public DicomInputStream(javax.imageio.stream.ImageInputStream iis,
                        TransferSyntax ts)
                 throws java.io.IOException
Throws:
java.io.IOException

DicomInputStream

public DicomInputStream(javax.imageio.stream.ImageInputStream iis)
                 throws java.io.IOException
Throws:
java.io.IOException

DicomInputStream

public DicomInputStream(java.io.InputStream in,
                        java.lang.String tsuid)
                 throws java.io.IOException
Throws:
java.io.IOException

DicomInputStream

public DicomInputStream(java.io.InputStream in)
                 throws java.io.IOException
Throws:
java.io.IOException

DicomInputStream

public DicomInputStream(java.io.InputStream in,
                        TransferSyntax ts)
                 throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getPreamble

public byte[] getPreamble()

getStreamPosition

public final long getStreamPosition()

setStreamPosition

public final void setStreamPosition(long pos)

tagPosition

public final long tagPosition()

getEndOfFileMetaInfoPosition

public final long getEndOfFileMetaInfoPosition()

setEndOfFileMetaInfoPosition

public final void setEndOfFileMetaInfoPosition(long fmiEndPos)

setHandler

public final void setHandler(DicomInputHandler handler)

tag

public final int tag()

level

public final int level()

valueLength

public final int valueLength()

vr

public final VR vr()

sq

public final DicomElement sq()

getTransferSyntax

public final TransferSyntax getTransferSyntax()

getDicomObject

public final DicomObject getDicomObject()

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

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

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.FilterInputStream

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.FilterInputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException

skipFully

public final void skipFully(long len)
                     throws java.io.IOException
Throws:
java.io.IOException

readFully

public final void readFully(byte[] b)
                     throws java.io.IOException
Throws:
java.io.IOException

readFully

public final void readFully(byte[] b,
                            int off,
                            int len)
                     throws java.io.IOException
Throws:
java.io.IOException

readHeader

public int readHeader()
               throws java.io.IOException
Throws:
java.io.IOException

readItem

public void readItem(DicomObject dest)
              throws java.io.IOException
Throws:
java.io.IOException

readDicomObject

public void readDicomObject(DicomObject dest,
                            int len)
                     throws java.io.IOException
Throws:
java.io.IOException

readDicomObject

public DicomObject readDicomObject()
                            throws java.io.IOException
Throws:
java.io.IOException

readFileMetaInformation

public void readFileMetaInformation(DicomObject dest)
                             throws java.io.IOException
Read File Meta Information from this stream into DicomObject.

If there is no File Meta Information on current stream position, the method returns without changing the stream position. Otherwise the stream will be parsed until the end of the File Meta Information is detected and File Meta Information elements are put into dest.

Parameters:
dest - DicomObject into which File Meta Information is read.
Throws:
java.io.EOFException - if this stream reaches the end before the end of the File Meta Information is detected.
java.io.IOException - if an I/O error occurs.

readFileMetaInformation

public DicomObject readFileMetaInformation()
                                    throws java.io.IOException
Read File Meta Information from this stream.

If there is no File Meta Information on current stream position, null is returned. Otherwise the stream will be parsed until the end of the File Meta Information is detected and a DicomObject containing the File Meta Information is returned.

Returns:
File Meta Information or null
Throws:
java.io.EOFException - if this stream reaches the end before the end of the File Meta Information is detected.
java.io.IOException - if an I/O error occurs.

readValue

public boolean readValue(DicomInputStream dis)
                  throws java.io.IOException
Description copied from interface: DicomInputHandler
Called by the input stream when reading a DICOM value in the stream.

Specified by:
readValue in interface DicomInputHandler
Parameters:
dis - The DicomInputStream calling this method.
Returns:
boolean true if the stream should continue reading the item.
Throws:
java.io.IOException

readItems

public void readItems(DicomElement sq,
                      int sqlen)
               throws java.io.IOException
Throws:
java.io.IOException

readBytes

public byte[] readBytes(int vallen)
                 throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2011 dcm4che. All Rights Reserved.