Class MllpSocketBuffer
- java.lang.Object
-
- org.apache.camel.component.mllp.internal.MllpSocketBuffer
-
public class MllpSocketBuffer extends Object
An OutputStream modeled after the ByteArrayOutputStream specifically for MLLP operations.
-
-
Constructor Summary
Constructors Constructor Description MllpSocketBuffer(MllpEndpoint endpoint)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcapacity()voidcloseMllpEnvelope()voidcloseSocket(Socket socket)voidcloseSocket(Socket socket, String logMessage)static StringformatAddressString(SocketAddress sourceAddress, SocketAddress targetAddress)intgetEndOfBlockIndex()byte[]getLeadingOutOfBandData()intgetStartOfBlockIndex()byte[]getTrailingOutOfBandData()booleanhasCompleteEnvelope()booleanhasEndOfBlock()booleanhasEndOfData()booleanhasLeadingOutOfBandData()booleanhasOutOfBandData()booleanhasStartOfBlock()booleanhasTrailingOutOfBandData()static booleanisConnectionValid(Socket socket)booleanisEmpty()booleanisEndOfDataRequired()voidopenMllpEnvelope()voidreadFrom(Socket socket)voidreadFrom(Socket socket, int receiveTimeout, int readTimeout)voidreset()voidresetSocket(Socket socket)voidresetSocket(Socket socket, String logMessage)voidsetEnvelopedMessage(byte[] hl7Payload)voidsetEnvelopedMessage(byte[] hl7Payload, int offset, int length)intsize()byte[]toByteArray()byte[]toByteArrayAndReset()StringtoHl7String()StringtoHl7String(String charsetName)StringtoHl7String(Charset charset)byte[]toMllpPayload()StringtoPrintFriendlyHl7String()Convert the enveloped contents of the buffer (excluding enveloping characters) to a print-friendly String representation.StringtoPrintFriendlyString()Convert the entire contents of the buffer (including enveloping characters) to a print-friendly String representation.StringtoPrintFriendlyStringAndReset()StringtoString()StringtoString(String charsetName)StringtoString(Charset charset)voidwrite(byte[] b)voidwrite(byte[] sourceBytes, int offset, int writeCount)voidwrite(int b)voidwriteTo(Socket socket)
-
-
-
Constructor Detail
-
MllpSocketBuffer
public MllpSocketBuffer(MllpEndpoint endpoint)
-
-
Method Detail
-
isEndOfDataRequired
public boolean isEndOfDataRequired()
-
isEmpty
public boolean isEmpty()
-
write
public void write(int b)
-
write
public void write(byte[] b)
-
write
public void write(byte[] sourceBytes, int offset, int writeCount)
-
openMllpEnvelope
public void openMllpEnvelope()
-
closeMllpEnvelope
public void closeMllpEnvelope()
-
setEnvelopedMessage
public void setEnvelopedMessage(byte[] hl7Payload)
-
setEnvelopedMessage
public void setEnvelopedMessage(byte[] hl7Payload, int offset, int length)
-
reset
public void reset()
-
readFrom
public void readFrom(Socket socket) throws MllpSocketException, SocketTimeoutException
-
readFrom
public void readFrom(Socket socket, int receiveTimeout, int readTimeout) throws MllpSocketException, SocketTimeoutException
-
writeTo
public void writeTo(Socket socket) throws MllpSocketException
- Throws:
MllpSocketException
-
toByteArray
public byte[] toByteArray()
-
toByteArrayAndReset
public byte[] toByteArrayAndReset()
-
toPrintFriendlyString
public String toPrintFriendlyString()
Convert the entire contents of the buffer (including enveloping characters) to a print-friendly String representation.- Returns:
- print-friendly String
-
toPrintFriendlyStringAndReset
public String toPrintFriendlyStringAndReset()
-
toHl7String
public String toHl7String()
-
toPrintFriendlyHl7String
public String toPrintFriendlyHl7String()
Convert the enveloped contents of the buffer (excluding enveloping characters) to a print-friendly String representation.- Returns:
- print-friendly String
-
toMllpPayload
public byte[] toMllpPayload()
-
getStartOfBlockIndex
public int getStartOfBlockIndex()
-
getEndOfBlockIndex
public int getEndOfBlockIndex()
-
hasCompleteEnvelope
public boolean hasCompleteEnvelope()
-
hasStartOfBlock
public boolean hasStartOfBlock()
-
hasEndOfBlock
public boolean hasEndOfBlock()
-
hasEndOfData
public boolean hasEndOfData()
-
hasOutOfBandData
public boolean hasOutOfBandData()
-
hasLeadingOutOfBandData
public boolean hasLeadingOutOfBandData()
-
hasTrailingOutOfBandData
public boolean hasTrailingOutOfBandData()
-
getLeadingOutOfBandData
public byte[] getLeadingOutOfBandData()
-
getTrailingOutOfBandData
public byte[] getTrailingOutOfBandData()
-
size
public int size()
-
capacity
public int capacity()
-
closeSocket
public void closeSocket(Socket socket)
-
resetSocket
public void resetSocket(Socket socket)
-
isConnectionValid
public static boolean isConnectionValid(Socket socket)
-
formatAddressString
public static String formatAddressString(SocketAddress sourceAddress, SocketAddress targetAddress)
-
-