Java UTF8 Encode toUTF8Bytes(final String s)

Here you can find the source of toUTF8Bytes(final String s)

Description

to UTF Bytes

License

Open Source License

Declaration

public static byte[] toUTF8Bytes(final String s) 

Method Source Code

//package com.java2s;

import java.io.UnsupportedEncodingException;

public class Main {
    public static byte[] toUTF8Bytes(final String s) {
        try {//  w  w  w.j  a  va  2s. c  om
            return s.getBytes("UTF-8");
        } catch (final UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. toUTF8(String str)
  2. toUTF8(String str)
  3. toUTF8(String string)
  4. toUTF8(String value)
  5. toUTF8ByteArray(char[] string)
  6. toUTF8Bytes(String src)
  7. toUTF8Bytes(String string)
  8. toUTF8InputStream(String str)
  9. toUTF8String(byte[] b, int offset, int length)