List of utility methods to do UTF8
boolean | hasLeadingWhitespace(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; |
void | inputStreamToFile(final InputStream inputStream, final File outputFile) Reads from an java.io.InputStream and writes to a java.io.File . Files.copy(inputStream, outputFile.toPath()); |
boolean | isSystemUtf8() is System Utf String systemEncoding = getSystemEncoding(); return (systemEncoding != null && systemEncoding.toUpperCase().equals("UTF-8")); |
boolean | isUtf8Supported() is Utf Supported return Charset.isSupported(UTF8);
|
StringBuffer | loadStringUTF8(InputStream in) load String UTF return loadString(new InputStreamReader(in, StandardCharsets.UTF_8)); |
Charset | makeUTF8() Create an instance of the UTF-8 charset. Charset utf8 = null; try { utf8 = Charset.forName("UTF-8"); } catch (Exception e) { return null; return utf8; |
void | moveFile(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()) { ... |
CharsetDecoder | newUTF8Decoder() new UTF Decoder return UTF_8.newDecoder();
|
BufferedReader | openFileUTF(String nom) open File UTF return getUTF8Reader(new File(nom)); |
int | putUTF8(byte[] data, int offset, String str) put UTF byte[] s = toUTF8Bytes(str); System.arraycopy(s, 0, data, offset, s.length); return s.length; |