class HttpUrl {

    static HttpUrl getChecked(String url) throws MalformedURLException, UnknownHostException {
        Builder builder = new Builder();
        Builder.ParseResult result = builder.parse(null, url);
        switch (result) {
            case SUCCESS:
                return builder.build();
            case INVALID_HOST:
                throw new UnknownHostException("Invalid host: " + url);
            case UNSUPPORTED_SCHEME:
            case MISSING_SCHEME:
            case INVALID_PORT:
            default:
                throw new MalformedURLException("Invalid URL: " + result + " for " + url);
        }
    }

    private  HttpUrl(Builder builder);

}