/*
(non-Javadoc)

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

        // TODO Auto-generated method stub
        switch (parameterCode & 0xFF) {
            case TransitNetworkSelection._PARAMETER_CODE:
                TransitNetworkSelection v = parameterFactory.createTransitNetworkSelection();
                ((AbstractISUPParameter) v).decode(parameterBody);
                setTransitNetworkSelection(v);
                break;
            case CallReference._PARAMETER_CODE:
                CallReference cr = parameterFactory.createCallReference();
                ((AbstractISUPParameter) cr).decode(parameterBody);
                this.setCallReference(cr);
                break;
            case CallingPartyNumber._PARAMETER_CODE:
                CallingPartyNumber cpn = parameterFactory.createCallingPartyNumber();
                ((AbstractISUPParameter) cpn).decode(parameterBody);
                this.setCallingPartyNumber(cpn);
                break;
            case OptionalForwardCallIndicators._PARAMETER_CODE:
                OptionalForwardCallIndicators ofci = parameterFactory.createOptionalForwardCallIndicators();
                ((AbstractISUPParameter) ofci).decode(parameterBody);
                this.setOptForwardCallIndicators(ofci);
                break;
            case RedirectingNumber._PARAMETER_CODE:
                RedirectingNumber rn = parameterFactory.createRedirectingNumber();
                ((AbstractISUPParameter) rn).decode(parameterBody);
                this.setRedirectingNumber(rn);
                break;
            case RedirectionInformation._PARAMETER_CODE:
                RedirectionInformation ri = parameterFactory.createRedirectionInformation();
                ((AbstractISUPParameter) ri).decode(parameterBody);
                this.setRedirectionInformation(ri);
                break;
            case ClosedUserGroupInterlockCode._PARAMETER_CODE:
                ClosedUserGroupInterlockCode cugic = parameterFactory.createClosedUserGroupInterlockCode();
                ((AbstractISUPParameter) cugic).decode(parameterBody);
                this.setCUserGroupInterlockCode(cugic);
                break;
            case ConnectionRequest._PARAMETER_CODE:
                ConnectionRequest cr2 = parameterFactory.createConnectionRequest();
                ((AbstractISUPParameter) cr2).decode(parameterBody);
                this.setConnectionRequest(cr2);
                break;
            case OriginalCalledNumber._PARAMETER_CODE:
                OriginalCalledNumber orn = parameterFactory.createOriginalCalledNumber();
                ((AbstractISUPParameter) orn).decode(parameterBody);
                this.setOriginalCalledNumber(orn);
                break;
            case UserToUserInformation._PARAMETER_CODE:
                UserToUserInformation u2ui = parameterFactory.createUserToUserInformation();
                ((AbstractISUPParameter) u2ui).decode(parameterBody);
                this.setU2UInformation(u2ui);
                break;
            case AccessTransport._PARAMETER_CODE:
                AccessTransport at = parameterFactory.createAccessTransport();
                ((AbstractISUPParameter) at).decode(parameterBody);
                this.setAccessTransport(at);
                break;
            case UserServiceInformation._PARAMETER_CODE:
                UserServiceInformation usi = parameterFactory.createUserServiceInformation();
                ((AbstractISUPParameter) usi).decode(parameterBody);
                this.setUserServiceInformation(usi);
                break;
            case UserToUserIndicators._PARAMETER_CODE:
                UserToUserIndicators utui = parameterFactory.createUserToUserIndicators();
                ((AbstractISUPParameter) utui).decode(parameterBody);
                this.setU2UIndicators(utui);
                break;
            case GenericNumber._PARAMETER_CODE:
                GenericNumber gn = parameterFactory.createGenericNumber();
                ((AbstractISUPParameter) gn).decode(parameterBody);
                this.setGenericNumber(gn);
                break;
            case PropagationDelayCounter._PARAMETER_CODE:
                PropagationDelayCounter pdc = parameterFactory.createPropagationDelayCounter();
                ((AbstractISUPParameter) pdc).decode(parameterBody);
                this.setPropagationDelayCounter(pdc);
                break;
            case UserServiceInformationPrime._PARAMETER_CODE:
                UserServiceInformationPrime usip = parameterFactory.createUserServiceInformationPrime();
                ((AbstractISUPParameter) usip).decode(parameterBody);
                this.setUserServiceInformationPrime(usip);
                break;
            case NetworkSpecificFacility._PARAMETER_CODE:
                NetworkSpecificFacility nsf = parameterFactory.createNetworkSpecificFacility();
                ((AbstractISUPParameter) nsf).decode(parameterBody);
                this.setNetworkSpecificFacility(nsf);
                break;
            case GenericDigits._PARAMETER_CODE:
                GenericDigits gd = parameterFactory.createGenericDigits();
                ((AbstractISUPParameter) gd).decode(parameterBody);
                this.setGenericDigits(gd);
                break;
            case OriginatingISCPointCode._PARAMETER_CODE:
                OriginatingISCPointCode vv = parameterFactory.createOriginatingISCPointCode();
                ((AbstractISUPParameter) vv).decode(parameterBody);
                this.setOriginatingISCPointCode(vv);
                break;
            case UserTeleserviceInformation._PARAMETER_CODE:
                UserTeleserviceInformation uti = parameterFactory.createUserTeleserviceInformation();
                ((AbstractISUPParameter) uti).decode(parameterBody);
                this.setUserTeleserviceInformation(uti);
                break;
            case RemoteOperations._PARAMETER_CODE:
                RemoteOperations ro = parameterFactory.createRemoteOperations();
                ((AbstractISUPParameter) ro).decode(parameterBody);
                this.setRemoteOperations(ro);
                break;
            case ParameterCompatibilityInformation._PARAMETER_CODE:
                ParameterCompatibilityInformation pci = parameterFactory.createParameterCompatibilityInformation();
                ((AbstractISUPParameter) pci).decode(parameterBody);
                this.setParameterCompatibilityInformation(pci);
                break;
            case GenericNotificationIndicator._PARAMETER_CODE:
                GenericNotificationIndicator gni = parameterFactory.createGenericNotificationIndicator();
                ((AbstractISUPParameter) gni).decode(parameterBody);
                this.setGenericNotificationIndicator(gni);
                break;
            case ServiceActivation._PARAMETER_CODE:
                ServiceActivation sa = parameterFactory.createServiceActivation();
                ((AbstractISUPParameter) sa).decode(parameterBody);
                this.setServiceActivation(sa);
                break;
            case GenericReference._PARAMETER_CODE:
                GenericReference gr = parameterFactory.createGenericReference();
                ((AbstractISUPParameter) gr).decode(parameterBody);
                this.setGenericReference(gr);
                break;
            case MLPPPrecedence._PARAMETER_CODE:
                MLPPPrecedence mlpp = parameterFactory.createMLPPPrecedence();
                ((AbstractISUPParameter) mlpp).decode(parameterBody);
                this.setMLPPPrecedence(mlpp);
                break;
            case TransmissionMediumRequirement._PARAMETER_CODE:
                TransmissionMediumRequirement tmr = parameterFactory.createTransmissionMediumRequirement();
                ((AbstractISUPParameter) tmr).decode(parameterBody);
                this.setTransmissionMediumRequirement(tmr);
                break;
            case LocationNumber._PARAMETER_CODE:
                LocationNumber ln = parameterFactory.createLocationNumber();
                ((AbstractISUPParameter) ln).decode(parameterBody);
                this.setLocationNumber(ln);
                break;
            case ForwardGVNS._PARAMETER_CODE:
                ForwardGVNS fgvns = parameterFactory.createForwardGVNS();
                ((AbstractISUPParameter) fgvns).decode(parameterBody);
                this.setForwardGVNS(fgvns);
                break;
            case CCSS._PARAMETER_CODE:
                CCSS ccss = parameterFactory.createCCSS();
                ((AbstractISUPParameter) ccss).decode(parameterBody);
                this.setCCSS(ccss);
                break;
            case NetworkManagementControls._PARAMETER_CODE:
                NetworkManagementControls nmc = parameterFactory.createNetworkManagementControls();
                ((AbstractISUPParameter) nmc).decode(parameterBody);
                this.setNetworkManagementControls(nmc);
                break;
            case CircuitAssigmentMap._PARAMETER_CODE:
                CircuitAssigmentMap cam = parameterFactory.createCircuitAssigmentMap();
                ((AbstractISUPParameter) cam).decode(parameterBody);
                this.setCircuitAssigmentMap(cam);
                break;
            case CorrelationID._PARAMETER_CODE:
                CorrelationID cid = parameterFactory.createCorrelationID();
                ((AbstractISUPParameter) cid).decode(parameterBody);
                this.setCorrelationID(cid);
                break;
            case CallDiversionTreatmentIndicators._PARAMETER_CODE:
                CallDiversionTreatmentIndicators cdti = parameterFactory.createCallDiversionTreatmentIndicators();
                ((AbstractISUPParameter) cdti).decode(parameterBody);
                this.setCallDiversionTreatmentIndicators(cdti);
                break;
            case CalledINNumber._PARAMETER_CODE:
                CalledINNumber cin = parameterFactory.createCalledINNumber();
                ((AbstractISUPParameter) cin).decode(parameterBody);
                this.setCalledINNumber(cin);
                break;
            case CallOfferingTreatmentIndicators._PARAMETER_CODE:
                CallOfferingTreatmentIndicators coti = parameterFactory.createCallOfferingTreatmentIndicators();
                ((AbstractISUPParameter) coti).decode(parameterBody);
                this.setCallOfferingTreatmentIndicators(coti);
                break;
            case ConferenceTreatmentIndicators._PARAMETER_CODE:
                ConferenceTreatmentIndicators cti = parameterFactory.createConferenceTreatmentIndicators();
                ((AbstractISUPParameter) cti).decode(parameterBody);
                this.setConferenceTreatmentIndicators(cti);
                break;
            case SCFID._PARAMETER_CODE:
                SCFID scfid = parameterFactory.createSCFID();
                ((AbstractISUPParameter) scfid).decode(parameterBody);
                this.setSCFID(scfid);
                break;
            case UIDCapabilityIndicators._PARAMETER_CODE:
                UIDCapabilityIndicators uci = parameterFactory.createUIDCapabilityIndicators();
                ((AbstractISUPParameter) uci).decode(parameterBody);
                this.setUIDCapabilityIndicators(uci);
                break;
            case EchoControlInformation._PARAMETER_CODE:
                EchoControlInformation eci = parameterFactory.createEchoControlInformation();
                ((AbstractISUPParameter) eci).decode(parameterBody);
                this.setEchoControlInformation(eci);
                break;
            case HopCounter._PARAMETER_CODE:
                HopCounter hc = parameterFactory.createHopCounter();
                ((AbstractISUPParameter) hc).decode(parameterBody);
                this.setHopCounter(hc);
                break;
            case CollectCallRequest._PARAMETER_CODE:
                CollectCallRequest ccr = parameterFactory.createCollectCallRequest();
                ((AbstractISUPParameter) ccr).decode(parameterBody);
                this.setCollectCallRequest(ccr);
                break;
            case ApplicationTransport._PARAMETER_CODE:
                ApplicationTransport atr = parameterFactory.createApplicationTransport();
                ((AbstractISUPParameter) atr).decode(parameterBody);
                this.setApplicationTransport(atr);
                break;
            case PivotCapability._PARAMETER_CODE:
                PivotCapability pc = parameterFactory.createPivotCapability();
                ((AbstractISUPParameter) pc).decode(parameterBody);
                this.setPivotCapability(pc);
                break;
            case CalledDirectoryNumber._PARAMETER_CODE:
                CalledDirectoryNumber cdn = parameterFactory.createCalledDirectoryNumber();
                ((AbstractISUPParameter) cdn).decode(parameterBody);
                this.setCalledDirectoryNumber(cdn);
                break;
            case OriginalCalledINNumber._PARAMETER_CODE:
                OriginalCalledINNumber ocin = parameterFactory.createOriginalCalledINNumber();
                ((AbstractISUPParameter) ocin).decode(parameterBody);
                this.setOriginalCalledINNumber(ocin);
                break;
            case NetworkRoutingNumber._PARAMETER_CODE:
                NetworkRoutingNumber nrn = parameterFactory.createNetworkRoutingNumber();
                ((AbstractISUPParameter) nrn).decode(parameterBody);
                this.setNetworkRoutingNumber(nrn);
                break;
            case QueryOnReleaseCapability._PARAMETER_CODE:
                QueryOnReleaseCapability qorc = parameterFactory.createQueryOnReleaseCapability();
                ((AbstractISUPParameter) qorc).decode(parameterBody);
                this.setQueryOnReleaseCapability(qorc);
                break;
            case PivotCounter._PARAMETER_CODE:
                PivotCounter pcntr = parameterFactory.createPivotCounter();
                ((AbstractISUPParameter) pcntr).decode(parameterBody);
                this.setPivotCounter(pcntr);
                break;
            case PivotRoutingForwardInformation._PARAMETER_CODE:
                PivotRoutingForwardInformation prfi = parameterFactory.createPivotRoutingForwardInformation();
                ((AbstractISUPParameter) prfi).decode(parameterBody);
                this.setPivotRoutingForwardInformation(prfi);
                break;
            case RedirectCapability._PARAMETER_CODE:
                RedirectCapability rc = parameterFactory.createRedirectCapability();
                ((AbstractISUPParameter) rc).decode(parameterBody);
                this.setRedirectCapability(rc);
                break;
            case RedirectCounter._PARAMETER_CODE:
                RedirectCounter rcntr = parameterFactory.createRedirectCounter();
                ((AbstractISUPParameter) rcntr).decode(parameterBody);
                this.setRedirectCounter(rcntr);
                break;
            case RedirectStatus._PARAMETER_CODE:
                RedirectStatus rs = parameterFactory.createRedirectStatus();
                ((AbstractISUPParameter) rs).decode(parameterBody);
                this.setRedirectStatus(rs);
                break;
            case RedirectForwardInformation._PARAMETER_CODE:
                RedirectForwardInformation rfi = parameterFactory.createRedirectForwardInformation();
                ((AbstractISUPParameter) rfi).decode(parameterBody);
                this.setRedirectForwardInformation(rfi);
                break;
            default:
                throw new ParameterException("Unrecognized parameter code for optional part: " + parameterCode);
        }
    }
902879
@Nullable
  @ReturnsMutableCopy
  public static byte [] safeDecode (@Nullable final String sEncoded, final int nOptions)
  {
    if (sEncoded != null)
      try
      {
        return decode (sEncoded, nOptions);
      }
      catch (final Exception ex)
      {
        // fall through
      }
    return null;
  }
341738
@Override
	public void decode(FacesContext context, UIComponent component) {
		SelectOneMenu menu = (SelectOneMenu) component;
		if (menu.isDisabled() || menu.isReadonly()) {
			return;
		}
		String outerClientId = menu.getClientId(context);
		String clientId = outerClientId + "Inner";
		String submittedOptionValue = (String) context.getExternalContext().getRequestParameterMap().get(clientId);

		Converter converter = menu.getConverter();
		if (null == converter) {
			converter = findImplicitConverter(context, component);
		}
		List<SelectItemAndComponent> items = SelectItemUtils.collectOptions(context, menu, converter);

		if (null != submittedOptionValue) {
			for (int index = 0; index < items.size(); index++) {
				Object currentOption = items.get(index).getSelectItem();
				String currentOptionValueAsString;
				Object currentOptionValue = null;
				if (currentOption instanceof SelectItem) {
					if (!((SelectItem) currentOption).isDisabled()) {
						currentOptionValue = ((SelectItem) currentOption).getValue();
					}
				}
				if (currentOptionValue instanceof String) {
					currentOptionValueAsString = (String) currentOptionValue;
				} else if (null != converter) {
					currentOptionValueAsString = converter.getAsString(context, component, currentOptionValue);
				} else if (currentOptionValue != null) {
					currentOptionValueAsString = String.valueOf(index);
				} else {
					currentOptionValueAsString = ""; // null values are submitted as empty strings
				}
				if (submittedOptionValue.equals(currentOptionValueAsString)) {
					Object submittedValue = null;
					if (currentOptionValue == null) {
						submittedValue = null;
					} else {
						submittedValue = null != converter ? currentOptionValueAsString : currentOptionValue;
					}
					menu.setSubmittedValue(submittedValue);
					menu.setValid(true);
					
					menu.validateValue(context, submittedValue);
					new AJAXRenderer().decode(context, component, clientId);
					if (menu.isValid()) {
						if (currentOptionValue == null)  {
							menu.setLocalValueSet(true);
						}
					}
					return;
				}
			}
			menu.validateValue(context, null);
			menu.setSubmittedValue(null);
			menu.setValid(false);
			return;
		}

		menu.setValid(true);
		menu.validateValue(context, submittedOptionValue);
		menu.setSubmittedValue(submittedOptionValue);
		new AJAXRenderer().decode(context, component, clientId);
	}
317621
private static JsJmsMessage decodeTextBody(String body) throws MessageDecodeFailedException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "decodeTextBody");
        JsJmsTextMessage result = new JsJmsTextMessageImpl(MfpConstants.CONSTRUCTOR_NO_OP);
        if (body != null) {
            result.setText(URLDecode(body));
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "decodeTextBody");
        return result;
    }
192503
function BodyParserOptions(options) {
  if (!(this instanceof BodyParserOptions))
    return new BodyParserOptions(options);

  this.keyLimit = 100;
  this.bodyLimit = 20 << 20;
  this.contentType = null;
  this.timeout = 10 * 1000;

  if (options)
    this.fromOptions(options);
}
930108
public CloseableImage decodeAnimatedWebp(
      final EncodedImage encodedImage,
      final int length,
      final QualityInfo qualityInfo,
      final ImageDecodeOptions options) {
    return mAnimatedWebPDecoder.decode(encodedImage, length, qualityInfo, options);
  }
858417
public static boolean decodeBoolean(byte[] src, int srcOffset)
        throws CorruptEncodingException
    {
        try {
            return src[srcOffset] == (byte)128;
        } catch (IndexOutOfBoundsException e) {
            throw new CorruptEncodingException(null, e);
        }
    }
829038
def _decode_body(content_type: Optional[str], body: bytes,
                 *, strict: bool = False) -> Any:
    
    type_, encoding = _parse_content_type(content_type)
    if not len(body) or not content_type:
        return None
    decoded_body = body.decode(encoding)
    if type_ == "application/json":
        return json.loads(decoded_body)
    elif type_ == "application/x-www-form-urlencoded":
        return json.loads(urllib.parse.parse_qs(decoded_body)["payload"][0])
    elif strict:
        raise ValueError(f"unrecognized content type: {type_!r}")
    return decoded_body
398305
public static Optional<String> readOptString(ByteBuf bf) {
      Optional<byte[]> bytes = readOptRangedBytes(bf);
      return bytes.map(b -> new String(b, CharsetUtil.UTF_8));
   }
1101462
private Boolean readOptionalBoolean(JSONObject json, String key) {

        try {
            return Boolean.valueOf(json.getBoolean(key));
        } catch (JSONException e) {
            LOG.debug("Reading optional JSON boolean failed. Default to provided default value.", e);
        }
        return null;
    }
601078
@Override
    public int decode ( byte[] buffer, int bufferIndex, int len ) throws SMBProtocolDecodingException {
        int start = bufferIndex;

        this.capabilities = SMBUtil.readInt4(buffer, bufferIndex);
        bufferIndex += 4;

        System.arraycopy(buffer, bufferIndex, this.serverGuid, 0, 16);
        bufferIndex += 16;

        this.securityMode = SMBUtil.readInt2(buffer, bufferIndex);
        this.dialect = SMBUtil.readInt2(buffer, bufferIndex + 2);
        bufferIndex += 4;

        return bufferIndex - start;
    }
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);
        }
    }
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));

    }
1224972
@Internal
    public void setBody(T body) {
        this.body = () -> Optional.ofNullable(body);
        this.convertedBodies.clear();
    }
438113
@Override
    public byte[] decode(final String data) {
        return data != null ? data.getBytes(CHARSET) : null;
    }
13314
private void prepareRequestBody() throws IOException {

    if (bodyByteArray != null) {
      setByteArrayBody();
    } else if (bodyString != null) {
      setStringBody();
    } else if (bodyObject != null) {
      setTypedBody();
    }
  }
1151891
protected void encodeOptionalParameters(Map<Integer, ISUPParameter> parameters, ByteArrayOutputStream bos)
            throws ParameterException {

        // NOTE: parameters MUST have as last endOfOptionalParametersParameter+1
        // param
        for (ISUPParameter p : parameters.values()) {

            if (p == null)
                continue;

            byte[] b = ((AbstractISUPParameter) p).encode();
            // System.err.println("ENCODE O: "+p.getCode()+"---> "+Utils.toHex(b));
            // FIXME: this can be slow, maybe we shoudl remove that, and code
            // this explicitly?
            if (b.length > 255) {
                throw new ParameterException("Parameter length is over 255: " + p);
            }
            if (!(p instanceof EndOfOptionalParametersImpl)) {
                bos.write(p.getCode());

                bos.write(b.length);
            }
            try {
                bos.write(b);
            } catch (IOException e) {
                throw new ParameterException("Failed to encode optional parameters.", e);
            }
        }

    }