Java UTF8 loadStringUTF8(InputStream in)

Here you can find the source of loadStringUTF8(InputStream in)

Description

load String UTF

License

Open Source License

Declaration

public static StringBuffer loadStringUTF8(InputStream in) throws IOException 

Method Source Code


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

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
    public static StringBuffer loadStringUTF8(InputStream in) throws IOException {
        return loadString(new InputStreamReader(in, StandardCharsets.UTF_8));
    }/*from  w ww .ja  v  a2  s . co  m*/

    public static StringBuffer loadString(Reader reader) throws IOException {
        try (BufferedReader bis = new BufferedReader(reader)) {
            StringBuffer sb = new StringBuffer();
            for (;;) {
                int c = bis.read();
                if (c < 0) {
                    break;
                }
                sb.append((char) c);
            }
            return sb;
        }
    }
}

Related

  1. getUTF8Writer(String path)
  2. hasLeadingWhitespace(File inputFile)
  3. inputStreamToFile(final InputStream inputStream, final File outputFile)
  4. isSystemUtf8()
  5. isUtf8Supported()
  6. makeUTF8()
  7. moveFile(File inFile, File outFile)
  8. newUTF8Decoder()
  9. openFileUTF(String nom)