Class MessageEncoderDecoderAdapter

java.lang.Object
org.serviceconnector.net.MessageEncoderDecoderAdapter
All Implemented Interfaces:
IEncoderDecoder
Direct Known Subclasses:
DefaultMessageEncoderDecoder, KeepAliveMessageEncoderDecoder, LargeMessageEncoderDecoder

public abstract class MessageEncoderDecoderAdapter extends Object implements IEncoderDecoder
The Class MessageEncoderDecoderAdapter.
Author:
JTraber
  • Constructor Details

    • MessageEncoderDecoderAdapter

      public MessageEncoderDecoderAdapter()
  • Method Details

    • decode

      public Object decode(InputStream is) throws Exception
      Decode input stream.
      Specified by:
      decode in interface IEncoderDecoder
      Parameters:
      is - the is to decode
      Returns:
      the object decoded
      Throws:
      Exception - the exception
    • writeHeadLine

      protected void writeHeadLine(SCMPVersion scmpVersion, BufferedWriter bw, SCMPHeaderKey headerKey, int messageSize, int headerSize) throws IOException
      Write head line.
      Parameters:
      scmpVersion - the SCMP version
      bw - the bufferedWriter
      headerKey - the header key
      messageSize - the message size
      headerSize - the header size
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • writeHeader

      protected StringBuilder writeHeader(Map<String,String> metaMap)
      Write header.
      Parameters:
      metaMap - the meta map
      Returns:
      the string builder
    • compressBody

      protected byte[] compressBody(byte[] bodyBuffer, int bodyOffset, int bodyLength) throws IOException
      Compress body.
      Parameters:
      bodyBuffer - the body buffer
      bodyOffset - the body offset
      bodyLength - the body length
      Returns:
      the byte[]
      Throws:
      IOException - Signals that an I/O exception has occurred.