Package gov.nih.mipav.model.dicomcomm
Class DICOM_FileIO
- java.lang.Object
-
- gov.nih.mipav.model.dicomcomm.DICOM_Comms
-
- gov.nih.mipav.model.dicomcomm.DICOM_FileIO
-
public class DICOM_FileIO extends DICOM_Comms
DICOM communication package reads the data from the socket and saves the data to a file stream. When pushing, data is read (streamed) from the file and push out to the socket.
This DICOM communication package was originally based on the Java Dicom Package, whose license is below:Java Dicom Package (com.zmed.dicom) Copyright (c) 1996-1997 Z Medical Imaging Systems, Inc. This software is provided, as is, for non-commercial educational purposes only. Use or incorporation of this software or derivative works in commercial applications requires written consent from Z Medical Imaging Systems, Inc. Z MEDICAL IMAGING SYSTEMS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR CONFORMANCE TO ANY SPECIFICATION OR STANDARD. Z MEDICAL IMAGING SYSTEMS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING OR MODIFYING THIS SOFTWARE OR ITS DERIVATIVES. ============================================================================= This software package is implemented similarly to the UC Davis public domain C++ DICOM implementation which contains the following copyright notice: Copyright (C) 1995, University of California, Davis THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND THE UNIVERSITY OF CALIFORNIA DOES NOT MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH THE USER. Copyright of the software and supporting documentation is owned by the University of California, and free access is hereby granted as a license to use this software, copy this software and prepare derivative works based upon this software. However, any distribution of this software source code or supporting documentation or derivative works (source code and supporting documentation) must include this copyright notice. The UC Davis C++ source code is publicly available from the following anonymous ftp site: ftp://imrad.ucdmc.ucdavis.edu/pub/dicom/UCDMC/
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class gov.nih.mipav.model.dicomcomm.DICOM_Comms
DICOM_Comms.ByteBuffer
-
-
Field Summary
Fields Modifier and Type Field Description java.io.FileInputStream
inFileStream
File input stream object.java.io.FileOutputStream
outFileStream
File output stream object.-
Fields inherited from class gov.nih.mipav.model.dicomcomm.DICOM_Comms
BIG_ENDIAN, breakSize, inBuffersLength, incomingBuffers, LITTLE_ENDIAN, MAX_READ_LENGTH, outBuffersLength, outgoingBuffers
-
-
Constructor Summary
Constructors Constructor Description DICOM_FileIO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes both the input and output streams if not null.void
finalize()
Prepares this class for destruction.boolean
openForRead(java.lang.String fileName)
Open file input stream for file.boolean
openForWrite(java.lang.String fileName)
Open file output stream for the file.int
readBinary(byte[] data, int count)
Read file stream data into buffer.void
sendBinary(byte[] data, int count)
Writes bytes from the data buffer into the file stream.-
Methods inherited from class gov.nih.mipav.model.dicomcomm.DICOM_Comms
bufferToInt16, bufferToInt32, flush, flush, getIncomingEndian, getIncomingSize, getOutgoingEndian, getOutgoingSize, int16ToBuffer, int32ToBuffer, peekFirstByte, peekForEndOfSequence, read, read, readByte, readBytes, readFill, readInt32, readShort16, seekToEndOfGroupTwoTags, sendBinary, setIncomingEndianess, setOutgoingEndianess, write, write, writeByte, writeByteIn, writeIn, writeInt32, writeInt32In, writeShort16, writeShort16In
-
-
-
-
Method Detail
-
close
public void close()
Closes both the input and output streams if not null.
-
finalize
public void finalize()
Description copied from class:DICOM_Comms
Prepares this class for destruction.- Overrides:
finalize
in classDICOM_Comms
-
openForRead
public boolean openForRead(java.lang.String fileName)
Open file input stream for file.- Parameters:
fileName
- name of the file to open- Returns:
- true if sucessfully open file for reading
-
openForWrite
public boolean openForWrite(java.lang.String fileName)
Open file output stream for the file.- Parameters:
fileName
- name of the file to open for writing- Returns:
- true if sucessfully opened file for writing
-
readBinary
public int readBinary(byte[] data, int count) throws DICOM_Exception
Read file stream data into buffer.- Overrides:
readBinary
in classDICOM_Comms
- Parameters:
data
- buffer in which to store data from file streamcount
- number of bytes to read into buffer- Returns:
- The actual number of bytes read.
- Throws:
DICOM_Exception
- Throws an exception if there was a problem readiing in the data to the port.
-
sendBinary
public void sendBinary(byte[] data, int count) throws DICOM_Exception
Writes bytes from the data buffer into the file stream.- Parameters:
data
- buffer which holds the info to outputcount
- number of bytes to output- Throws:
DICOM_Exception
- Throws an exception if there was a problem outputting the data to the port.
-
-