private String validate(InputStream in) throws IOException, SAXException {
            if (!used.compareAndSet(false, true)) {
                throw new IllegalStateException("OneOffValidator instances are not reusable");
            }
            validator.checkHtmlInputSource(new InputSource(in));
            errorHandler.end(MSG_SUCCESS, MSG_FAIL, "");
            return new String(out.toByteArray(), StandardCharsets.UTF_8);
        }
Self-contained, single use class for encapsulated building of an embedded
validator.
src/nu/validator/client/EmbeddedValidator.java