Java UTF8 stringToUTF8Bytes(String str)

Here you can find the source of stringToUTF8Bytes(String str)

Description

string To UTF Bytes

License

Open Source License

Declaration

public static byte[] stringToUTF8Bytes(String str) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.nio.charset.Charset;

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

    public static byte[] stringToUTF8Bytes(String str) {
        if (str == null)
            return null;

        return str.getBytes(UTF8_CHARSET);
    }//from www  .  j  a  v a2 s .c  om
}

Related

  1. openFileUTF(String nom)
  2. putUTF8(byte[] data, int offset, String str)
  3. sort(String inFile, int keyIndex, String outFile)
  4. stringFromBytesUTF8(byte[] bytes)
  5. stringToUtf8(String str)
  6. toBytesUTF8(String s)
  7. toBytesUTF8(String str)
  8. unZip(String zipFile, String outputFolder, boolean skipDirectory)
  9. utf8(String string)