Java UTF8 asUTF8bytes(String s)

Here you can find the source of asUTF8bytes(String s)

Description

as UT Fbytes

License

Open Source License

Declaration

public static byte[] asUTF8bytes(String s) 

Method Source Code


//package com.java2s;
import java.io.UnsupportedEncodingException;

public class Main {
    public static byte[] asUTF8bytes(String s) {
        try {//from   w  ww  .  j ava  2 s. com
            return s.getBytes("UTF-8");
        } catch (UnsupportedEncodingException ex) {
            throw new InternalError("UTF-8 not supported!");
        }
    }
}

Related

  1. appendToFile(String outputFile, String contents)
  2. asStringUTF8(byte[] bytes)
  3. asUTF16BEEncoded(String basicString)
  4. asUtf8(byte[] bytes)
  5. asUTF8(InputStream in)
  6. asUtf8ByteStream(final String string)
  7. asUTF8String(byte[] bytes)
  8. asUTFString(byte[] content)
  9. backup(String inputFile, String backupFile)