Checks if encoder should be applied to a input with given encoding state

@param encoderToApply
the encoder to apply
@param currentEncodingState
the current encoding state
@return true, if should encode
18977
public static boolean shouldEncodeWith(Encoder encoderToApply, EncodingState currentEncodingState) {
        if(isNoneEncoder(encoderToApply)) return false;
        if (currentEncodingState != null && currentEncodingState.getEncoders() != null) {
            for (Encoder encoder : currentEncodingState.getEncoders()) {
                if (isPreviousEncoderSafeOrEqual(encoderToApply, encoder)) {
                    return false;
                }
            }
        }
        return true;
    }
100025
@Override
    public boolean isCharsetSupported(String charset) {
        if (null == charset) {
            return false;
        }
        Boolean supported = this.supportedEncodingsCache.get(charset);
        if (supported != null) {
            return supported.booleanValue();
        }
        try {
            new String(TEST_CHAR, charset);
            supported = Boolean.TRUE;
        } catch (UnsupportedEncodingException e) {
            supported = Boolean.FALSE;
        }
        this.supportedEncodingsCache.put(charset, supported);
        return supported.booleanValue();
    }
1344094
public static boolean isCharsetSupported (String charset){
        Boolean supported = (Boolean) supportedEncodingsCache.get(charset);
        if(supported != null){
            return supported.booleanValue();
        }
        try{
            new String (TEST_CHAR, charset);
            supportedEncodingsCache.put(charset, Boolean.TRUE);
        }catch (UnsupportedEncodingException e){
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
                logger.logp(Level.FINE, CLASS_NAME,"isCharsetSupported", "Encountered UnsupportedEncoding charset [" + charset +"]");
            }
            supportedEncodingsCache.put(charset, Boolean.FALSE);
            return false;
        }
        return true;
    }
1060042
public static void checkEncoding(String encoding) throws IOException {
	try {
	    URLEncoder.encode("", encoding);
	}
	catch (UnsupportedEncodingException e) {
	    throw new IOException("invalid encoding [" + encoding + "]");
	}
    }
1067405
private boolean checkOutputFileEncoding(String docencoding,
            DocErrorReporter reporter) {
        OutputStream ost= new ByteArrayOutputStream();
        OutputStreamWriter osw = null;
        try {
            osw = new OutputStreamWriter(ost, docencoding);
        } catch (UnsupportedEncodingException exc) {
            reporter.printError(getText("doclet.Encoding_not_supported",
                docencoding));
            return false;
        } finally {
            try {
                if (osw != null) {
                    osw.close();
                }
            } catch (IOException exc) {
            }
        }
        return true;
    }
158550
public void encode(AsnOutputStream aos) throws EncodeException {

        if (this.localOperationCode == null && this.globalOperationCode == null)
            throw new EncodeException("Operation code: No Operation code set!");

        try {
            if (this.type == OperationCodeType.Local) {
                aos.writeInteger(this.localOperationCode);
            } else if (this.type == OperationCodeType.Global) {
                aos.writeObjectIdentifier(this.globalOperationCode);
            } else {
                throw new EncodeException();
            }

        } catch (IOException e) {
            throw new EncodeException(e);
        } catch (AsnException e) {
            throw new EncodeException(e);
        }
    }
596144
public static boolean validate(Map<String, String> rspData, String encoding) {
		return SDKUtil.validate(rspData, encoding);
	}
1155359
@Reference(policy=ReferencePolicy.DYNAMIC)
    protected void setEncodingService(EncodingUtils encUtils) {
        encodingServiceRef.set(encUtils);
    }
870627
public void setCharacterEncoding(String encoding)
    {
        if (this._outputState==0 && !isCommitted())
        {
            _charEncodingSetInContentType=true;
            _httpResponse.setCharacterEncoding(encoding,true);
        }
    }
37285
public static boolean isValidJavaEncoding(String javaEncoding) {
        if (javaEncoding != null) {
            int length = javaEncoding.length();
            if (length > 0) {
                for (int i = 1; i < length; i++) {
                    char c = javaEncoding.charAt(i);
                    if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&
                        (c < '0' || c > '9') && c != '.' && c != '_' &&
                        c != '-') {
                        return false;
                    }
                }
                return true;
            }
        }
        return false;
    }
849084
public void encode(AsnOutputStream aos) throws EncodeException {

        if (this.nationalOperationCode == null && this.privateOperationCode == null)
            throw new EncodeException("Operation code: No Operation code set!");

        try {
            if (this.type == OperationCodeType.National && this.nationalOperationCode != null) {
                aos.writeInteger(Tag.CLASS_PRIVATE, OperationCode._TAG_NATIONAL, this.nationalOperationCode);
            } else if (this.type == OperationCodeType.Private && this.privateOperationCode != null) {
                aos.writeInteger(Tag.CLASS_PRIVATE, OperationCode._TAG_PRIVATE, this.privateOperationCode);
            } else {
                throw new EncodeException("Operation code: No Operation code set!");
            }

        } catch (IOException e) {
            throw new EncodeException("IOException while encoding OperationCode: " + e.getMessage(), e);
        } catch (AsnException e) {
            throw new EncodeException("AsnException while encoding OperationCode: " + e.getMessage(), e);
        }
    }
814717
public function useEncoding()
    {
        if ($this->encoding === null) {
            return false;
        }
        
        if (!function_exists('mb_strtolower')) {
            throw new FilterException(
                'mbstring is required to use ToLower with an encoding.');
        }

        $this->encoding = (string) $this->encoding;
        $encodings = array_map('strtolower', mb_list_encodings());
        
        if (!in_array(strtolower($this->encoding), $encodings)) {
            throw new FilterException(
                "mbstring does not support the '".$this->encoding."' encoding"
            );
        }

        return true;
    }
65325
public void encode(AsnOutputStream aos) throws EncodeException {

        // commented code is the whole case encoding implementation
        // now only one version is supported - we use for optimization purpose simple encoding
        // aos.writeBitString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_PROTOCOL_VERSION, _VALUE);
        aos.write(128);
        aos.write(2);
        aos.write(7);
        aos.write(128);

        // BitSetStrictLength bs = new BitSetStrictLength(1);
        // bs.set(0);
        // try {
        // aos.writeBitString(Tag.CLASS_CONTEXT_SPECIFIC, _TAG_PROTOCOL_VERSION, bs);
        // } catch (AsnException e) {
        // // TODO Auto-generated catch block
        // e.printStackTrace();
        // } catch (IOException e) {
        // // TODO Auto-generated catch block
        // e.printStackTrace();
        // }
    }
200519
@Override
  public void transcodeWebpToPng(
      InputStream inputStream,
      OutputStream outputStream) throws IOException {
    StaticWebpNativeLoader.ensure();
    nativeTranscodeWebpToPng(
        Preconditions.checkNotNull(inputStream),
        Preconditions.checkNotNull(outputStream));
  }
1280289
private boolean isMessageCompressed() {
        String contentEncoding = m_request.getHeader(HttpDefs.CONTENT_ENCODING);
        if (contentEncoding != null) {
            if (!contentEncoding.equalsIgnoreCase("gzip")) {
                throw new IllegalArgumentException("Unsupported Content-Encoding: " + contentEncoding);
            }
            return true;
        }
        return false;
    }
699926
public void setCharacterEncoding(String encoding)
        throws UnsupportedEncodingException
    {
        if (_inputState!=0)
            throw new IllegalStateException("getReader() or getInputStream() called");
        "".getBytes(encoding);
        _httpRequest.setCharacterEncoding(encoding,false);
    }
171825
private void encodeThis() throws IOException {
        if (maps == null || maps.isEmpty()) {
            this.extensionValue = null;
            return;
        }
        DerOutputStream os = new DerOutputStream();
        DerOutputStream tmp = new DerOutputStream();

        for (CertificatePolicyMap map : maps) {
            map.encode(tmp);
        }

        os.write(DerValue.tag_Sequence, tmp);
        this.extensionValue = os.toByteArray();
    }