Class HL7MLLPCodec

  • All Implemented Interfaces:
    org.apache.mina.filter.codec.ProtocolCodecFactory

    public class HL7MLLPCodec
    extends Object
    implements org.apache.mina.filter.codec.ProtocolCodecFactory
    HL7 MLLP codec.

    This codec supports encoding/decoding the HL7 MLLP protocol. It will use the default markers for start and end combination:

    • 0x0b (11 decimal) = start marker
    • 0x0d (13 decimal = the \r char) = segment terminators
    • 0x1c (28 decimal) = end 1 marker
    • 0x0d (13 decimal) = end 2 marker

    The decoder is used for decoding from MLLP (bytes) to String. The String will not contain any of the start and end markers.

    The encoder is used for encoding from String to MLLP (bytes). The String should not contain any of the start and end markers, the encoder will add these, and stream the string as bytes.

    This codes supports charset encoding/decoding between bytes and String. The JVM platform default charset is used, but the charset can be configured on this codec using the setter method. The decoder will use the JVM platform default charset for decoding, but the charset can be configured on the this codec.

    • Constructor Detail

      • HL7MLLPCodec

        public HL7MLLPCodec()
    • Method Detail

      • getDecoder

        public org.apache.mina.filter.codec.ProtocolDecoder getDecoder​(org.apache.mina.core.session.IoSession session)
                                                                throws Exception
        Specified by:
        getDecoder in interface org.apache.mina.filter.codec.ProtocolCodecFactory
        Throws:
        Exception
      • getEncoder

        public org.apache.mina.filter.codec.ProtocolEncoder getEncoder​(org.apache.mina.core.session.IoSession session)
                                                                throws Exception
        Specified by:
        getEncoder in interface org.apache.mina.filter.codec.ProtocolCodecFactory
        Throws:
        Exception
      • setCharset

        public void setCharset​(Charset charset)
      • setCharset

        public void setCharset​(String charsetName)
      • getCharset

        public Charset getCharset()
      • isConvertLFtoCR

        public boolean isConvertLFtoCR()
      • setConvertLFtoCR

        public void setConvertLFtoCR​(boolean convertLFtoCR)
      • getStartByte

        public char getStartByte()
      • setStartByte

        public void setStartByte​(char startByte)
      • getEndByte1

        public char getEndByte1()
      • setEndByte1

        public void setEndByte1​(char endByte1)
      • getEndByte2

        public char getEndByte2()
      • setEndByte2

        public void setEndByte2​(char endByte2)
      • isValidate

        public boolean isValidate()
      • setValidate

        public void setValidate​(boolean validate)
      • isProduceString

        public boolean isProduceString()
      • setProduceString

        public void setProduceString​(boolean apply)