Java Utililty Methods UTF8

List of utility methods to do UTF8

Description

The list of methods to do UTF8 are organized into topic(s).

Method

booleanhasLeadingWhitespace(File inputFile)
Checks whether a file contains any leading whitespace characters.
BufferedReader reader = Files.newBufferedReader(inputFile.toPath());
int character = reader.read();
if (character != -1 && Character.isWhitespace((char) character)) {
    return true;
reader.close();
return false;
voidinputStreamToFile(final InputStream inputStream, final File outputFile)
Reads from an java.io.InputStream and writes to a java.io.File .
Files.copy(inputStream, outputFile.toPath());
booleanisSystemUtf8()
is System Utf
String systemEncoding = getSystemEncoding();
return (systemEncoding != null && systemEncoding.toUpperCase().equals("UTF-8"));
booleanisUtf8Supported()
is Utf Supported
return Charset.isSupported(UTF8);
StringBufferloadStringUTF8(InputStream in)
load String UTF
return loadString(new InputStreamReader(in, StandardCharsets.UTF_8));
CharsetmakeUTF8()
Create an instance of the UTF-8 charset.
Charset utf8 = null;
try {
    utf8 = Charset.forName("UTF-8");
} catch (Exception e) {
    return null;
return utf8;
voidmoveFile(File inFile, File outFile)
Moves a file.
if (inFile.equals(outFile)) {
    return;
if (!inFile.isFile()) {
    throw new IOException(inFile.getAbsolutePath() + " is not a file");
if (outFile.exists()) {
    if (!outFile.isFile()) {
...
CharsetDecodernewUTF8Decoder()
new UTF Decoder
return UTF_8.newDecoder();
BufferedReaderopenFileUTF(String nom)
open File UTF
return getUTF8Reader(new File(nom));
intputUTF8(byte[] data, int offset, String str)
put UTF
byte[] s = toUTF8Bytes(str);
System.arraycopy(s, 0, data, offset, s.length);
return s.length;