gov.nih.mipav.model.dicomcomm
Class DICOM_Socket

java.lang.Object
  extended by gov.nih.mipav.model.dicomcomm.DICOM_Socket

public class DICOM_Socket
extends Object

Simple class to setup and the socket and streams.


Field Summary
 boolean connected
          Flag indicating whether of not the socket is connected.
 InputStream inStream
          Input stream object acquired from the socket.
 OutputStream outStream
          Output stream object acquired from the socket.
 Socket socket
          Socket object.
static int timeout
          DOCUMENT ME!
 
Constructor Summary
DICOM_Socket()
          DICOMSocket constructor.
 
Method Summary
 void attach(Socket socket)
          Attaches this DICOMSocket to a JAVA socket.
 void close()
          Closes the socket.
 void open(String ip, int port)
          Open (and connect) a socket.
 int readBinary(byte[] data, int count)
          Low level socket read.
 void writeBinary(byte[] data, int offset, int count)
          Low level socket write.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeout

public static final int timeout
DOCUMENT ME!

See Also:
Constant Field Values

connected

public boolean connected
Flag indicating whether of not the socket is connected.


inStream

public InputStream inStream
Input stream object acquired from the socket.


outStream

public OutputStream outStream
Output stream object acquired from the socket.


socket

public Socket socket
Socket object.

Constructor Detail

DICOM_Socket

public DICOM_Socket()
DICOMSocket constructor.

Method Detail

attach

public void attach(Socket socket)
            throws DICOM_Exception
Attaches this DICOMSocket to a JAVA socket.

Parameters:
socket - the socket to attach
Throws:
DICOM_Exception - DOCUMENT ME!

close

public void close()
Closes the socket.


open

public void open(String ip,
                 int port)
          throws DICOM_Exception
Open (and connect) a socket.

Parameters:
ip - the ip address to connect to
port - the port number to connect to
Throws:
DICOM_Exception - DOCUMENT ME!

readBinary

public int readBinary(byte[] data,
                      int count)
               throws DICOM_Exception
Low level socket read.

Parameters:
data - buffer to store the data
count - number of bytes to be read
Returns:
DOCUMENT ME!
Throws:
DICOM_Exception - DOCUMENT ME!

writeBinary

public void writeBinary(byte[] data,
                        int offset,
                        int count)
                 throws DICOM_Exception
Low level socket write.

Parameters:
data - buffer of data send out the port (connection)\
offset - offset
count - number of bytes to be sent
Throws:
DICOM_Exception - DOCUMENT ME!