public abstract class Association
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
associationNumber |
protected java.lang.String |
calledAETitle |
protected java.lang.String |
callingAETitle |
protected java.io.InputStream |
in |
protected java.lang.String |
localHostName |
protected int |
maximumLengthReceived |
protected java.io.OutputStream |
out |
protected java.util.LinkedList |
presentationContexts |
protected java.lang.String |
remoteHostName |
protected java.util.LinkedList |
scuSCPRoleSelections |
protected java.net.Socket |
socket |
Modifier | Constructor and Description |
---|---|
protected |
Association() |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Send an A-ABORT-RQ.
|
int |
getAssociationNumber() |
AssociationOutputStream |
getAssociationOutputStream(byte presentationContextID)
A factory method to build an
AssociationOutputStream
for this Association, on which to send data which is fragmented as appropriate
into PDUs. |
abstract java.lang.String |
getCalledAEHostName() |
abstract int |
getCalledAEPort() |
java.lang.String |
getCalledAETitle() |
abstract java.lang.String |
getCallingAEHostName() |
abstract int |
getCallingAEPort() |
java.lang.String |
getCallingAETitle() |
java.lang.String |
getEndpointDescription() |
protected java.lang.String |
getLocalHostName() |
protected int |
getLocalPort() |
protected java.lang.String |
getRemoteHostName() |
protected int |
getRemotePort() |
protected static byte[] |
getRestOfPDU(java.io.InputStream in,
byte[] startBuffer,
int pduLength) |
byte |
getSuitablePresentationContextID(java.lang.String abstractSyntaxUID)
Find a Presentation Context for the a particular SOP Class UID, using any
available Transfer Syntax but preferring compressed then, Explicit VR Little Endian, then
any Explicit VR, over Implicit VR.
|
byte |
getSuitablePresentationContextID(java.lang.String abstractSyntaxUID,
java.lang.String transferSyntaxUID)
Find a Presentation Context for a particular combination of SOP Class UID and Transfer Syntax.
|
java.lang.String |
getTransferSyntaxForPresentationContextID(byte identifier)
Get the Transfer Syntax UID of the Presentation Context specified by the Presentation Context ID.
|
protected static void |
readInsistently(java.io.InputStream in,
byte[] b,
int offset,
int length,
java.lang.String what) |
void |
release()
Send an A-RELEASE-RQ.
|
void |
send(byte presentationContextID,
byte[] command,
byte[] data)
Send a command and/or data in a single PDU, each PDV with the last fragment flag set.
|
void |
setReceivedDataHandler(ReceivedDataHandler h)
Register a
ReceivedDataHandler to handle each PDU
as it is received. |
protected void |
setSocketOptions(java.net.Socket socket,
int ourMaximumLengthReceived,
int socketReceiveBufferSize,
int socketSendBufferSize)
Set the socket options for either initiator or acceptor.
|
java.lang.String |
toString() |
void |
waitForCommandPDataPDUs()
Continue to transfer data (remain in State 6) until the last fragment of a command has been received.
|
void |
waitForDataPDataPDUs()
Continue to transfer data (remain in State 6) until the last fragment of data has been received.
|
void |
waitForOnePDataPDU()
Continue to transfer data (remain in State 6) until one PDU has been
received.
|
void |
waitForPDataPDUs(int count,
boolean stopAfterLastFragmentOfCommand,
boolean stopAfterLastFragmentOfData,
boolean stopAfterHandlerReportsDone)
Continue to transfer data (remain in State 6) until the specified number of PDUs have been
received or the specified conditions are satisfied.
|
void |
waitForPDataPDUsUntilHandlerReportsDone()
Continue to transfer data (remain in State 6) until the data handler reports that it is done.
|
protected int associationNumber
protected java.lang.String calledAETitle
protected java.lang.String callingAETitle
protected java.io.InputStream in
protected java.lang.String localHostName
protected int maximumLengthReceived
protected java.io.OutputStream out
protected java.util.LinkedList presentationContexts
protected java.lang.String remoteHostName
protected java.util.LinkedList scuSCPRoleSelections
protected java.net.Socket socket
public void abort() throws DicomNetworkException
DicomNetworkException
public int getAssociationNumber()
public AssociationOutputStream getAssociationOutputStream(byte presentationContextID) throws DicomNetworkException
AssociationOutputStream
for this Association, on which to send data which is fragmented as appropriate
into PDUs.presentationContextID
- included in the header of each PDUDicomNetworkException
public abstract java.lang.String getCalledAEHostName()
public abstract int getCalledAEPort()
public java.lang.String getCalledAETitle()
public abstract java.lang.String getCallingAEHostName()
public abstract int getCallingAEPort()
public java.lang.String getCallingAETitle()
public java.lang.String getEndpointDescription()
protected java.lang.String getLocalHostName()
protected int getLocalPort()
protected java.lang.String getRemoteHostName()
protected int getRemotePort()
protected static byte[] getRestOfPDU(java.io.InputStream in, byte[] startBuffer, int pduLength) throws DicomNetworkException, java.io.IOException
in
- startBuffer
- pduLength
- java.io.IOException
DicomNetworkException
public byte getSuitablePresentationContextID(java.lang.String abstractSyntaxUID) throws DicomNetworkException
abstractSyntaxUID
- the SOP Class UID for which to find a suitable Presentation ContextDicomNetworkException
- thrown if no suitable Presentation Contextpublic byte getSuitablePresentationContextID(java.lang.String abstractSyntaxUID, java.lang.String transferSyntaxUID) throws DicomNetworkException
abstractSyntaxUID
- the SOP Class UID for which to find a suitable Presentation ContexttransferSyntaxUID
- the Transfer Syntax UID for which to find a suitable Presentation ContextDicomNetworkException
- thrown if no suitable Presentation Contextpublic java.lang.String getTransferSyntaxForPresentationContextID(byte identifier) throws DicomNetworkException
identifier
- the Presentation Context IDDicomNetworkException
- thrown if no such Presentation Context or no Transfer Syntax for that Presentation Context (e.g. it was rejected)protected static void readInsistently(java.io.InputStream in, byte[] b, int offset, int length, java.lang.String what) throws DicomNetworkException, java.io.IOException
in
- b
- offset
- length
- what
- java.io.IOException
DicomNetworkException
public void release() throws DicomNetworkException
DicomNetworkException
public void send(byte presentationContextID, byte[] command, byte[] data) throws DicomNetworkException
presentationContextID
- included in the header of each PDUcommand
- the command PDV payload, or null if nonedata
- the data PDV payload, or null if noneDicomNetworkException
public void setReceivedDataHandler(ReceivedDataHandler h) throws DicomNetworkException
ReceivedDataHandler
to handle each PDU
as it is received.h
- an implementation of the abstract class ReceivedDataHandler
DicomNetworkException
protected void setSocketOptions(java.net.Socket socket, int ourMaximumLengthReceived, int socketReceiveBufferSize, int socketSendBufferSize) throws java.io.IOException
Set the socket options for either initiator or acceptor.
Must be called before using the socket or the options won't set.
socket
- the socket whose options to setourMaximumLengthReceived
- the maximum PDU length that we will offer to receivesocketReceiveBufferSize
- the TCP socket receive buffer size to set (if possible), 0 means leave at the defaultsocketSendBufferSize
- the TCP socket send buffer size to set (if possible), 0 means leave at the defaultjava.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public void waitForCommandPDataPDUs() throws DicomNetworkException, AReleaseException
DicomNetworkException
- A-ABORT or A-P-ABORT indicationAReleaseException
- A-RELEASE indication; transport connection is closedpublic void waitForDataPDataPDUs() throws DicomNetworkException, AReleaseException
DicomNetworkException
- A-ABORT or A-P-ABORT indicationAReleaseException
- A-RELEASE indication; transport connection is closedpublic void waitForOnePDataPDU() throws DicomNetworkException, AReleaseException
DicomNetworkException
- A-ABORT or A-P-ABORT indicationAReleaseException
- A-RELEASE indication; transport connection is closedpublic void waitForPDataPDUs(int count, boolean stopAfterLastFragmentOfCommand, boolean stopAfterLastFragmentOfData, boolean stopAfterHandlerReportsDone) throws DicomNetworkException, AReleaseException
count
- the number of PDUs to be transferred, or -1 if no limit (stop only when conditions satisfied)stopAfterLastFragmentOfCommand
- stop after the last fragment of a command has been receivedstopAfterLastFragmentOfData
- stop after the last fragment of data has been receivedstopAfterHandlerReportsDone
- stop after data handler reports that it is doneDicomNetworkException
- A-ABORT or A-P-ABORT indicationAReleaseException
- A-RELEASE indication; transport connection is closedpublic void waitForPDataPDUsUntilHandlerReportsDone() throws DicomNetworkException, AReleaseException
DicomNetworkException
- A-ABORT or A-P-ABORT indicationAReleaseException
- A-RELEASE indication; transport connection is closed