Android Utililty Methods InputStream Encoding Get

List of utility methods to do InputStream Encoding Get

Description

The list of methods to do InputStream Encoding Get are organized into topic(s).

Method

StringgetStreamEncoding(InputStream is)
get Stream Encoding
BufferedInputStream bis = new BufferedInputStream(is);
bis.mark(2);
byte[] first3bytes = new byte[3];
bis.read(first3bytes);
bis.reset();
String encoding = null;
if (first3bytes[0] == (byte) 0xEF && first3bytes[1] == (byte) 0xBB
        && first3bytes[2] == (byte) 0xBF) {
...
StringgetStreamEncoding(InputStream is)
get Stream Encoding
BufferedInputStream bis = new BufferedInputStream(is);
bis.mark(2);
byte[] first3bytes = new byte[3];
bis.read(first3bytes);
bis.reset();
String encoding = null;
if (first3bytes[0] == (byte) 0xEF && first3bytes[1] == (byte) 0xBB
        && first3bytes[2] == (byte) 0xBF) {
...
StringgetEncodingFromHTML(InputStream is)
get Encoding From HTML
final int FIND_CHARSET_CACHE_SIZE = 4 * 1024;
BufferedInputStream bis = new BufferedInputStream(is);
bis.mark(FIND_CHARSET_CACHE_SIZE);
byte[] cache = new byte[FIND_CHARSET_CACHE_SIZE];
bis.read(cache);
bis.reset();
return getHtmlCharset(new String(cache));