/*
(non-Javadoc)

@see org.mobicents.isup.messages.ISUPMessage#decodeOptionalBody(byte[], byte)
331
protected void decodeOptionalBody(ISUPParameterFactory parameterFactory, byte[] parameterBody, byte parameterCode)
            throws ParameterException {

        switch (parameterCode & 0xFF) {
            case CauseIndicators._PARAMETER_CODE:
                CauseIndicators cpn = parameterFactory.createCauseIndicators();
                ((AbstractISUPParameter) cpn).decode(parameterBody);
                this.setCauseIndicators(cpn);
                break;
            default:
                throw new ParameterException("Unrecognized parameter index for optional part: " + parameterCode);
        }

    }
1115676
private Object parseOption(UNode optionNode) {
        if (optionNode.isValue()) {
            return optionNode.getValue();
        }
        Map<String, Object> optValueMap = new HashMap<>();
        for (UNode suboptNode : optionNode.getMemberList()) {
            optValueMap.put(suboptNode.getName(), parseOption(suboptNode));
        }
        return optValueMap;
    }
1121713
private void parseBodyMultipart() {
        if (undecodedChunk == null || undecodedChunk.readableBytes() == 0) {
            // nothing to decode
            return;
        }
        InterfaceHttpData data = decodeMultipart(currentStatus);
        while (data != null) {
            addHttpData(data);
            if (currentStatus == MultiPartStatus.PREEPILOGUE || currentStatus == MultiPartStatus.EPILOGUE) {
                break;
            }
            data = decodeMultipart(currentStatus);
        }
    }
1143723
protected void decodeOptionalBody(ISUPParameterFactory parameterFactory, byte[] parameterBody, byte parameterCode)
            throws ParameterException {
        switch (parameterCode & 0xFF) {
            case CauseIndicators._PARAMETER_CODE:
                CauseIndicators CI = parameterFactory.createCauseIndicators();
                ((AbstractISUPParameter) CI).decode(parameterBody);
                this.setCauseIndicators(CI);
                break;

            case CallReference._PARAMETER_CODE:
                CallReference CR = parameterFactory.createCallReference();
                ((AbstractISUPParameter) CR).decode(parameterBody);
                this.setCallReference(CR);
                break;
            case BackwardCallIndicators._PARAMETER_CODE:
                BackwardCallIndicators BCMI = parameterFactory.createBackwardCallIndicators();
                ((AbstractISUPParameter) BCMI).decode(parameterBody);
                this.setBackwardCallIndicators(BCMI);
                break;
            case OptionalBackwardCallIndicators._PARAMETER_CODE:
                OptionalBackwardCallIndicators OBCI = parameterFactory.createOptionalBackwardCallIndicators();
                ((AbstractISUPParameter) OBCI).decode(parameterBody);
                this.setOptionalBackwardCallIndicators(OBCI);
                break;
            case AccessTransport._PARAMETER_CODE:
                AccessTransport AT = parameterFactory.createAccessTransport();
                ((AbstractISUPParameter) AT).decode(parameterBody);
                this.setAccessTransport(AT);
                break;
            case UserToUserIndicators._PARAMETER_CODE:
                UserToUserIndicators U2UI = parameterFactory.createUserToUserIndicators();
                ((AbstractISUPParameter) U2UI).decode(parameterBody);
                this.setUserToUserIndicators(U2UI);
                break;
            case RedirectionNumber._PARAMETER_CODE:
                RedirectionNumber RN = parameterFactory.createRedirectionNumber();
                ((AbstractISUPParameter) RN).decode(parameterBody);
                this.setRedirectionNumber(RN);
                break;
            case UserToUserInformation._PARAMETER_CODE:
                UserToUserInformation U2UII = parameterFactory.createUserToUserInformation();
                ((AbstractISUPParameter) U2UII).decode(parameterBody);
                this.setUserToUserInformation(U2UII);
                break;
            case GenericNotificationIndicator._PARAMETER_CODE:
                GenericNotificationIndicator GNI = parameterFactory.createGenericNotificationIndicator();
                ((AbstractISUPParameter) GNI).decode(parameterBody);
                this.setGenericNotificationIndicator(GNI);
                break;
            case NetworkSpecificFacility._PARAMETER_CODE:
                NetworkSpecificFacility NSF = parameterFactory.createNetworkSpecificFacility();
                ((AbstractISUPParameter) NSF).decode(parameterBody);
                this.setNetworkSpecificFacility(NSF);
                break;
            case RemoteOperations._PARAMETER_CODE:
                RemoteOperations RO = parameterFactory.createRemoteOperations();
                ((AbstractISUPParameter) RO).decode(parameterBody);
                this.setRemoteOperations(RO);
                break;
            case TransmissionMediumUsed._PARAMETER_CODE:
                TransmissionMediumUsed TMU = parameterFactory.createTransmissionMediumUsed();
                ((AbstractISUPParameter) TMU).decode(parameterBody);
                this.setTransmissionMediumUsed(TMU);
                break;
            case AccessDeliveryInformation._PARAMETER_CODE:
                AccessDeliveryInformation ADI = parameterFactory.createAccessDeliveryInformation();
                ((AbstractISUPParameter) ADI).decode(parameterBody);
                this.setAccessDeliveryInformation(ADI);
                break;
            case ParameterCompatibilityInformation._PARAMETER_CODE:
                ParameterCompatibilityInformation PCI = parameterFactory.createParameterCompatibilityInformation();
                ((AbstractISUPParameter) PCI).decode(parameterBody);
                this.setParameterCompatibilityInformation(PCI);
                break;
            case CallDiversionInformation._PARAMETER_CODE:
                CallDiversionInformation CDI = parameterFactory.createCallDiversionInformation();
                ((AbstractISUPParameter) CDI).decode(parameterBody);
                this.setCallDiversionInformation(CDI);
                break;
            case ServiceActivation._PARAMETER_CODE:
                ServiceActivation SA = parameterFactory.createServiceActivation();
                ((AbstractISUPParameter) SA).decode(parameterBody);
                this.setServiceActivation(SA);
                break;
            case RedirectionNumberRestriction._PARAMETER_CODE:
                RedirectionNumberRestriction RNR = parameterFactory.createRedirectionNumberRestriction();
                ((AbstractISUPParameter) RNR).decode(parameterBody);
                this.setRedirectionNumberRestriction(RNR);
                break;
            case CallTransferNumber._PARAMETER_CODE:
                CallTransferNumber CTR = parameterFactory.createCallTransferNumber();
                ((AbstractISUPParameter) CTR).decode(parameterBody);
                this.setCallTransferNumber(CTR);
                break;
            case EchoControlInformation._PARAMETER_CODE:
                EchoControlInformation ECI = parameterFactory.createEchoControlInformation();
                ((AbstractISUPParameter) ECI).decode(parameterBody);
                this.setEchoControlInformation(ECI);
                break;
            case ConnectedNumber._PARAMETER_CODE:
                ConnectedNumber CN = parameterFactory.createConnectedNumber();
                ((AbstractISUPParameter) CN).decode(parameterBody);
                this.setConnectedNumber(CN);
                break;
            case BackwardGVNS._PARAMETER_CODE:
                BackwardGVNS BGVNS = parameterFactory.createBackwardGVNS();
                ((AbstractISUPParameter) BGVNS).decode(parameterBody);
                this.setBackwardGVNS(BGVNS);
                break;
            case GenericNumber._PARAMETER_CODE:
                GenericNumber GN = parameterFactory.createGenericNumber();
                ((AbstractISUPParameter) GN).decode(parameterBody);
                this.setGenericNumber(GN);
                break;
            case CallHistoryInformation._PARAMETER_CODE:
                CallHistoryInformation CHI = parameterFactory.createCallHistoryInformation();
                ((AbstractISUPParameter) CHI).decode(parameterBody);
                this.setCallHistoryInformation(CHI);
                break;
            case ConferenceTreatmentIndicators._PARAMETER_CODE:
                ConferenceTreatmentIndicators CTI = parameterFactory.createConferenceTreatmentIndicators();
                ((AbstractISUPParameter) CTI).decode(parameterBody);
                this.setConferenceTreatmentIndicators(CTI);
                break;
            case UIDActionIndicators._PARAMETER_CODE:
                UIDActionIndicators UIDA = parameterFactory.createUIDActionIndicators();
                ((AbstractISUPParameter) UIDA).decode(parameterBody);
                this.setUIDActionIndicators(UIDA);
                break;
            case ApplicationTransport._PARAMETER_CODE:
                ApplicationTransport ATP = parameterFactory.createApplicationTransport();
                ((AbstractISUPParameter) ATP).decode(parameterBody);
                this.setApplicationTransportParameter(ATP);
                break;
            case CCNRPossibleIndicator._PARAMETER_CODE:
                CCNRPossibleIndicator CCNR = parameterFactory.createCCNRPossibleIndicator();
                ((AbstractISUPParameter) CCNR).decode(parameterBody);
                this.setCCNRPossibleIndicator(CCNR);
                break;
            case PivotRoutingBackwardInformation._PARAMETER_CODE:
                PivotRoutingBackwardInformation PRBI = parameterFactory.createPivotRoutingBackwardInformation();
                ((AbstractISUPParameter) PRBI).decode(parameterBody);
                this.setPivotRoutingBackwardInformation(PRBI);
                break;
            case RedirectStatus._PARAMETER_CODE:
                RedirectStatus RS = parameterFactory.createRedirectStatus();
                ((AbstractISUPParameter) RS).decode(parameterBody);
                this.setRedirectStatus(RS);
                break;
            case EndOfOptionalParametersImpl._PARAMETER_CODE:
                // we add this by default
                break;
            default:
                throw new ParameterException("Unrecognized parameter code for optional part: " + parameterCode);
        }

    }
697027
public static Boolean decodeBooleanObj(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            switch (src[srcOffset]) {
            case NULL_BYTE_LOW: case NULL_BYTE_HIGH:
                return null;
            case (byte)128:
                return Boolean.TRUE;
            default:
                return Boolean.FALSE;
            }
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
13314
private void prepareRequestBody() throws IOException {

    if (bodyByteArray != null) {
      setByteArrayBody();
    } else if (bodyString != null) {
      setStringBody();
    } else if (bodyObject != null) {
      setTypedBody();
    }
  }
365729
private void parseBodyAttributes() {
        if (!undecodedChunk.hasArray()) {
            parseBodyAttributesStandard();
            return;
        }
        SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk);
        int firstpos = undecodedChunk.readerIndex();
        int currentpos = firstpos;
        int equalpos;
        int ampersandpos;
        if (currentStatus == MultiPartStatus.NOTSTARTED) {
            currentStatus = MultiPartStatus.DISPOSITION;
        }
        boolean contRead = true;
        try {
            loop: while (sao.pos < sao.limit) {
                char read = (char) (sao.bytes[sao.pos++] & 0xFF);
                currentpos++;
                switch (currentStatus) {
                case DISPOSITION:// search '='
                    if (read == '=') {
                        currentStatus = MultiPartStatus.FIELD;
                        equalpos = currentpos - 1;
                        String key = decodeAttribute(undecodedChunk.toString(firstpos, equalpos - firstpos, charset),
                                charset);
                        currentAttribute = factory.createAttribute(request, key);
                        firstpos = currentpos;
                    } else if (read == '&') { // special empty FIELD
                        currentStatus = MultiPartStatus.DISPOSITION;
                        ampersandpos = currentpos - 1;
                        String key = decodeAttribute(
                                undecodedChunk.toString(firstpos, ampersandpos - firstpos, charset), charset);
                        currentAttribute = factory.createAttribute(request, key);
                        currentAttribute.setValue(""); // empty
                        addHttpData(currentAttribute);
                        currentAttribute = null;
                        firstpos = currentpos;
                        contRead = true;
                    }
                    break;
                case FIELD:// search '&' or end of line
                    if (read == '&') {
                        currentStatus = MultiPartStatus.DISPOSITION;
                        ampersandpos = currentpos - 1;
                        setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
                        firstpos = currentpos;
                        contRead = true;
                    } else if (read == HttpConstants.CR) {
                        if (sao.pos < sao.limit) {
                            read = (char) (sao.bytes[sao.pos++] & 0xFF);
                            currentpos++;
                            if (read == HttpConstants.LF) {
                                currentStatus = MultiPartStatus.PREEPILOGUE;
                                ampersandpos = currentpos - 2;
                                sao.setReadPosition(0);
                                setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
                                firstpos = currentpos;
                                contRead = false;
                                break loop;
                            } else {
                                // Error
                                sao.setReadPosition(0);
                                throw new ErrorDataDecoderException("Bad end of line");
                            }
                        } else {
                            if (sao.limit > 0) {
                                currentpos--;
                            }
                        }
                    } else if (read == HttpConstants.LF) {
                        currentStatus = MultiPartStatus.PREEPILOGUE;
                        ampersandpos = currentpos - 1;
                        sao.setReadPosition(0);
                        setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
                        firstpos = currentpos;
                        contRead = false;
                        break loop;
                    }
                    break;
                default:
                    // just stop
                    sao.setReadPosition(0);
                    contRead = false;
                    break loop;
                }
            }
            if (isLastChunk && currentAttribute != null) {
                // special case
                ampersandpos = currentpos;
                if (ampersandpos > firstpos) {
                    setFinalBuffer(undecodedChunk.copy(firstpos, ampersandpos - firstpos));
                } else if (!currentAttribute.isCompleted()) {
                    setFinalBuffer(EMPTY_BUFFER);
                }
                firstpos = currentpos;
                currentStatus = MultiPartStatus.EPILOGUE;
            } else if (contRead && currentAttribute != null && currentStatus == MultiPartStatus.FIELD) {
                // reset index except if to continue in case of FIELD getStatus
                currentAttribute.addContent(undecodedChunk.copy(firstpos, currentpos - firstpos),
                                            false);
                firstpos = currentpos;
            }
            undecodedChunk.readerIndex(firstpos);
        } catch (ErrorDataDecoderException e) {
            // error while decoding
            undecodedChunk.readerIndex(firstpos);
            throw e;
        } catch (IOException e) {
            // error while decoding
            undecodedChunk.readerIndex(firstpos);
            throw new ErrorDataDecoderException(e);
        } catch (IllegalArgumentException e) {
            // error while decoding
            undecodedChunk.readerIndex(firstpos);
            throw new ErrorDataDecoderException(e);
        }
    }
119533
protected void decodeOptionalBody(ISUPParameterFactory parameterFactory, byte[] parameterBody, byte parameterCode)
            throws ParameterException {

        switch (parameterCode & 0xFF) {

            case BackwardCallIndicators._PARAMETER_CODE:
                BackwardCallIndicators bci = parameterFactory.createBackwardCallIndicators();
                ((AbstractISUPParameter) bci).decode(parameterBody);
                this.setBackwardCallIndicators(bci);
                break;
            case OptionalBackwardCallIndicators._PARAMETER_CODE:
                OptionalBackwardCallIndicators OBCI = parameterFactory.createOptionalBackwardCallIndicators();
                ((AbstractISUPParameter) OBCI).decode(parameterBody);
                this.setOptionalBackwardCallIndicators(OBCI);
                break;
            case CallReference._PARAMETER_CODE:
                CallReference CR = parameterFactory.createCallReference();
                ((AbstractISUPParameter) CR).decode(parameterBody);
                this.setCallReference(CR);
                break;
            case UserToUserIndicators._PARAMETER_CODE:
                UserToUserIndicators U2UI = parameterFactory.createUserToUserIndicators();
                ((AbstractISUPParameter) U2UI).decode(parameterBody);
                this.setUserToUserIndicators(U2UI);
                break;
            case UserToUserInformation._PARAMETER_CODE:
                UserToUserInformation U2UII = parameterFactory.createUserToUserInformation();
                ((AbstractISUPParameter) U2UII).decode(parameterBody);
                this.setUserToUserInformation(U2UII);
                break;
            case ConnectedNumber._PARAMETER_CODE:
                ConnectedNumber CN = parameterFactory.createConnectedNumber();
                ((AbstractISUPParameter) CN).decode(parameterBody);
                this.setConnectedNumber(CN);
                break;
            case AccessTransport._PARAMETER_CODE:
                AccessTransport AT = parameterFactory.createAccessTransport();
                ((AbstractISUPParameter) AT).decode(parameterBody);
                this.setAccessTransport(AT);
                break;
            case AccessDeliveryInformation._PARAMETER_CODE:
                AccessDeliveryInformation ADI = parameterFactory.createAccessDeliveryInformation();
                ((AbstractISUPParameter) ADI).decode(parameterBody);
                this.setAccessDeliveryInformation(ADI);
                break;
            case GenericNotificationIndicator._PARAMETER_CODE:
                GenericNotificationIndicator GNI = parameterFactory.createGenericNotificationIndicator();
                ((AbstractISUPParameter) GNI).decode(parameterBody);
                this.setGenericNotificationIndicator(GNI);
                break;
            case ParameterCompatibilityInformation._PARAMETER_CODE:
                ParameterCompatibilityInformation PCI = parameterFactory.createParameterCompatibilityInformation();
                ((AbstractISUPParameter) PCI).decode(parameterBody);
                this.setParameterCompatibilityInformation(PCI);
                break;
            case BackwardGVNS._PARAMETER_CODE:
                BackwardGVNS BGVNS = parameterFactory.createBackwardGVNS();
                ((AbstractISUPParameter) BGVNS).decode(parameterBody);
                this.setBackwardGVNS(BGVNS);
                break;
            case CallHistoryInformation._PARAMETER_CODE:
                CallHistoryInformation CHI = parameterFactory.createCallHistoryInformation();
                ((AbstractISUPParameter) CHI).decode(parameterBody);
                this.setCallHistoryInformation(CHI);
                break;
            case GenericNumber._PARAMETER_CODE:
                GenericNumber GN = parameterFactory.createGenericNumber();
                ((AbstractISUPParameter) GN).decode(parameterBody);
                this.setGenericNumber(GN);
                break;
            case TransmissionMediumUsed._PARAMETER_CODE:
                TransmissionMediumUsed TMU = parameterFactory.createTransmissionMediumUsed();
                ((AbstractISUPParameter) TMU).decode(parameterBody);
                this.setTransmissionMediumUsed(TMU);
                break;
            case NetworkSpecificFacility._PARAMETER_CODE:
                NetworkSpecificFacility NSF = parameterFactory.createNetworkSpecificFacility();
                ((AbstractISUPParameter) NSF).decode(parameterBody);
                this.setNetworkSpecificFacility(NSF);
                break;
            case RemoteOperations._PARAMETER_CODE:
                RemoteOperations RO = parameterFactory.createRemoteOperations();
                ((AbstractISUPParameter) RO).decode(parameterBody);
                this.setRemoteOperations(RO);
                break;
            case RedirectionNumber._PARAMETER_CODE:
                RedirectionNumber RN = parameterFactory.createRedirectionNumber();
                ((AbstractISUPParameter) RN).decode(parameterBody);
                this.setRedirectionNumber(RN);
                break;
            case ServiceActivation._PARAMETER_CODE:
                ServiceActivation SA = parameterFactory.createServiceActivation();
                ((AbstractISUPParameter) SA).decode(parameterBody);
                this.setServiceActivation(SA);
                break;
            case EchoControlInformation._PARAMETER_CODE:
                EchoControlInformation ECI = parameterFactory.createEchoControlInformation();
                ((AbstractISUPParameter) ECI).decode(parameterBody);
                this.setEchoControlInformation(ECI);
                break;
            case RedirectionNumberRestriction._PARAMETER_CODE:
                RedirectionNumberRestriction RNR = parameterFactory.createRedirectionNumberRestriction();
                ((AbstractISUPParameter) RNR).decode(parameterBody);
                this.setRedirectionNumberRestriction(RNR);
                break;
            case DisplayInformation._PARAMETER_CODE:
                DisplayInformation DI = parameterFactory.createDisplayInformation();
                ((AbstractISUPParameter) DI).decode(parameterBody);
                this.setDisplayInformation(DI);
                break;
            case ConferenceTreatmentIndicators._PARAMETER_CODE:
                ConferenceTreatmentIndicators CTI = parameterFactory.createConferenceTreatmentIndicators();
                ((AbstractISUPParameter) CTI).decode(parameterBody);
                this.setConferenceTreatmentIndicators(CTI);
                break;
            case ApplicationTransport._PARAMETER_CODE:
                ApplicationTransport ATP = parameterFactory.createApplicationTransport();
                ((AbstractISUPParameter) ATP).decode(parameterBody);
                this.setApplicationTransportParameter(ATP);
                break;
            case PivotRoutingBackwardInformation._PARAMETER_CODE:
                PivotRoutingBackwardInformation PRBI = parameterFactory.createPivotRoutingBackwardInformation();
                ((AbstractISUPParameter) PRBI).decode(parameterBody);
                this.setPivotRoutingBackwardInformation(PRBI);
                break;
            case RedirectStatus._PARAMETER_CODE:
                RedirectStatus RS = parameterFactory.createRedirectStatus();
                ((AbstractISUPParameter) RS).decode(parameterBody);
                this.setRedirectStatus(RS);
                break;
            default:
                throw new ParameterException("Unrecognized parameter code for optional part: " + parameterCode);
        }
    }
754723
protected void decodeMandatoryVariableBody(ISUPParameterFactory parameterFactory, byte[] parameterBody, int parameterIndex)
            throws ParameterException {
        throw new ParameterException("This message has no mandatory parameters, unknown parameter index: " + parameterIndex
                + ", body: " + ISUPUtility.toHex(parameterBody));

    }
1130210
private static JsJmsMessage decodeStreamBody(String body) throws MessageDecodeFailedException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "decodeStreamBody");
        JsJmsStreamMessage result = new JsJmsStreamMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
        if (body != null) {
            try {
                StringTokenizer st = new StringTokenizer(body, "&");
                while (st.hasMoreTokens())
                    result.writeObject(decodeObject(st.nextToken()));
            } catch (UnsupportedEncodingException e) {
                FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.WebJsJmsMessageFactoryImpl.decodeStreamBody", "196");
                // This can't happen, as the Exception can only be thrown for an MQ message
                // which isn't what we have.
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "decodeStreamBody");
        return result;
    }
1078263
private static JsJmsMessage decodeObjectBody(String body) throws MessageDecodeFailedException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "decodeObjectBody");
        JsJmsObjectMessage result = new JsJmsObjectMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
        if (body != null)
            result.setSerializedObject(HexString.hexToBin(body, 0));
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "decodeObjectBody");
        return result;
    }
619526
private static byte[] getDecodabet(int options) {
        if ((options & URL_SAFE) == URL_SAFE) {
            return _URL_SAFE_DECODABET;
        } else if ((options & ORDERED) == ORDERED) {
            return _ORDERED_DECODABET;
        } else {
            return _STANDARD_DECODABET;
        }
    }
1313781
private final static byte[] getDecodabet(final int options) {
    if ((options & Base64.URL_SAFE) == Base64.URL_SAFE) {
      return Base64._URL_SAFE_DECODABET;
    } else if ((options & Base64.ORDERED) == Base64.ORDERED) {
      return Base64._ORDERED_DECODABET;
    } else {
      return Base64._STANDARD_DECODABET;
    }

  }
989747
void parseOption(String option) {
    if (option.isEmpty()) {
      return;
    }

    @SuppressWarnings("StringSplitter")
    String[] keyAndValue = option.split(SPLIT_KEY_VALUE);
    requireArgument(keyAndValue.length <= 2,
        "key-value pair %s with more than one equals sign", option);

    String key = keyAndValue[0].trim();
    String value = (keyAndValue.length == 1) ? null : keyAndValue[1].trim();

    configure(key, value);
  }
813836
@Override
  public NetworkConnectionServiceMessage decode(final byte[] data) {
    try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) {
      try (final DataInputStream dais = new DataInputStream(bais)) {
        final String connFactoryId = dais.readUTF();
        final Identifier srcId = factory.getNewInstance(dais.readUTF());
        final Identifier destId = factory.getNewInstance(dais.readUTF());
        final int size = dais.readInt();
        final List list = new ArrayList(size);
        final Codec codec = connFactoryMap.get(connFactoryId).getCodec();
        Boolean isStreamingCodec = isStreamingCodecMap.get(codec);
        if (isStreamingCodec == null) {
          isStreamingCodec = codec instanceof StreamingCodec;
          isStreamingCodecMap.putIfAbsent(codec, isStreamingCodec);
        }

        if (isStreamingCodec) {
          for (int i = 0; i < size; i++) {
            list.add(((StreamingCodec) codec).decodeFromStream(dais));
          }
        } else {
          for (int i = 0; i < size; i++) {
            final int byteSize = dais.readInt();
            final byte[] bytes = new byte[byteSize];
            if (dais.read(bytes) == -1) {
              LOG.log(Level.FINE, "No data read because end of stream was reached");
            }
            list.add(codec.decode(bytes));
          }
        }

        return new NetworkConnectionServiceMessage(
            connFactoryId,
            srcId,
            destId,
            list
        );
      }
    } catch (final IOException e) {
      throw new RuntimeException("IOException", e);
    }
  }
1070194
public int decode(byte[] b) throws ParameterException {
        if (b == null || b.length != 1) {
            throw new ParameterException("byte[] must  not be null and length must  be 1");
        }

        this.transimissionMediumRequirement = b[0];

        return 1;
    }
1050149
public static void decodeUISelectOne(FacesContext facesContext, UIComponent component)
    {
        if (!(component instanceof EditableValueHolder))
        {
            throw new IllegalArgumentException("Component "
                    + component.getClientId(facesContext)
                    + " is not an EditableValueHolder");
        }
        if (isDisabledOrReadOnly(component))
        {
            return;
        }
        Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
        String clientId = component.getClientId(facesContext);
        if (paramMap.containsKey(clientId))
        {
            //request parameter found, set submitted value
            ((EditableValueHolder) component).setSubmittedValue(paramMap.get(clientId));
        }
        else
        {
            //see reason for this action at decodeUISelectMany
            ((EditableValueHolder) component).setSubmittedValue(STR_EMPTY);
        }
    }