Java UTF8 UTF8GetBytes(final String value)

Here you can find the source of UTF8GetBytes(final String value)

Description

Encodes all the characters in the specified string into a sequence of UTF-8 bytes.

License

Open Source License

Parameter

Parameter Description
value The string containing the characters to encode.

Return

A byte array containing the results of encoding the specified set of characters.

Declaration

public static byte[] UTF8GetBytes(final String value) 

Method Source Code


//package com.java2s;
// Licensed under the MIT license. See License.txt in the project root.

import java.nio.charset.Charset;

public class Main {
    private static final Charset UTF8 = Charset.forName("UTF-8");

    /**/*from  ww w.ja va2  s  .  c o m*/
     * Encodes all the characters in the specified string into a sequence of UTF-8 bytes.
     *
     * @param value The string containing the characters to encode.
     * @return A byte array containing the results of encoding the specified set of characters.
     */
    public static byte[] UTF8GetBytes(final String value) {
        final byte[] result = value.getBytes(UTF8);
        return result;
    }
}

Related

  1. utf8BufferByteLen(CharSequence str)
  2. utf8ByteLength(String string)
  3. utf8BytesToString(byte[] bytes, int start, int length)
  4. utf8BytesToString(final byte[] in_utf8Bytes)
  5. utf8CharLen(byte byte1)
  6. UTF8GetString(final byte[] bytes, final int index, final int count)
  7. utf8Len(byte b)
  8. utf8Length(byte[] buffer, int str, int len)
  9. utf8Replace(String str)