core/src/main/java/com/digitalpebble/stormcrawler/util/CharsetIdentification.java
private static String getCharsetFromBOM(final byte[] byteData) {
        BOMInputStream bomIn = new BOMInputStream(new ByteArrayInputStream(
                byteData));
        try {
            ByteOrderMark bom = bomIn.getBOM();
            if (bom != null) {
                return bom.getCharsetName();
            }
        } catch (IOException e) {
            return null;
        }
        return null;
    }
private static String getCharsetFromBOM(final byte[] byteData) {
        BOMInputStream bomIn = new BOMInputStream(new ByteArrayInputStream(
                byteData));
        try {
            ByteOrderMark bom = bomIn.getBOM();
            if (bom != null) {
                return bom.getCharsetName();
            }
        } catch (IOException e) {
            return null;
        }
        return null;
    }
Detects any BOMs and returns the corresponding charset