Java UTF8 decodePayloadFromUtf8(String utf8string)

Here you can find the source of decodePayloadFromUtf8(String utf8string)

Description

Helper method that takes an UTF-8 string and returns its byte representation.

License

Apache License

Parameter

Parameter Description
utf8string a parameter

Return

byte representation

Declaration

public static byte[] decodePayloadFromUtf8(String utf8string) 

Method Source Code


//package com.java2s;
/*// www.j av  a 2s  .com
 * Zed Attack Proxy (ZAP) and its related class files.
 * 
 * ZAP is an HTTP/HTTPS proxy for assessing web application security.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0 
 *   
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */

import java.nio.charset.Charset;

public class Main {
    /**
     * Used for en- & decoding from bytes to String and vice versa.
     */
    protected static final Charset UTF8_CHARSET = Charset.forName("UTF-8");

    /**
     * Helper method that takes an UTF-8 string and returns its byte
     * representation.
     * 
     * @param utf8string
     * @return byte representation
     */
    public static byte[] decodePayloadFromUtf8(String utf8string) {
        return utf8string.getBytes(UTF8_CHARSET);
    }
}

Related

  1. convertISO8859_1_to_UTF_8(String s)
  2. ConvertUTF8(byte[] buffer)
  3. createFileAndExport(String inputFileName, String outputFileName, String outputStr)
  4. createFromUTF8String(DatagramPacket packet, String str)
  5. createTemporaryOutputFolder()
  6. decodeUTF8(byte[] bytes)
  7. decodeUtf8(String url)
  8. decUTF8(String s)
  9. dumpStringArray(Path outputFilePath, String[] stringArray)