public static String getHtmlEncoding(InputStream ins){
int n;
byte[] buf = new byte[4096];
ManHtmlCharsetDetector detector = new ManHtmlCharsetDetector(null);
try{
while ((n=ins.read(buf)) > 0 && !detector.isDone()) {
detector.handleData(buf, 0, n);
}
detector.dataEnd();
}catch(Exception e){
throw new MnsearchException(e);
}
return detector.getDetectedCharset();
}
int n;
byte[] buf = new byte[4096];
ManHtmlCharsetDetector detector = new ManHtmlCharsetDetector(null);
try{
while ((n=ins.read(buf)) > 0 && !detector.isDone()) {
detector.handleData(buf, 0, n);
}
detector.dataEnd();
}catch(Exception e){
throw new MnsearchException(e);
}
return detector.getDetectedCharset();
}