public Reader getReader(InputStream in, String declaredEncoding) {
        fDeclaredEncoding = declaredEncoding;

        try {
            setText(in);

            CharsetMatch match = detect();

            if (match == null) {
                return null;
            }

            return match.getReader();
        } catch (IOException e) {
            return null;
        }
    }
@Test
    public void testEmptyOrNullDeclaredCharset() throws IOException {
        try (InputStream in = getResourceAsStream("/test-documents/resume.html")) {
            CharsetDetector detector = new CharsetDetector();
            Reader reader = detector.getReader(in, null);
            assertTrue(reader.ready());

            reader = detector.getReader(in, "");
            assertTrue(reader.ready());
        }
    }