public TypedOutputStream(OutputStream out, String mediaType, String charset) { this(out, MediaType.create(mediaType, charset)) ; }
TypedInputStreamHttp(InputStream input, String contentType, ClientConnectionManager connectMgr) { this(input, MediaType.create(contentType), connectMgr) ; }
/** * Parses the content type. It splits the string by semi-colon and finds the * other features such as the "q" quality factor. For a complete documentation * on how the parsing happens, see * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1</a>. * * @param contentType content type string * @return parsed media type */ static public MediaType parse(String contentType) { try { return MediaType.create(contentType) ; } catch (RuntimeException ex) { return null ; } }
public TypedOutputStream(OutputStream out, String mediaType, String charset) { this(out, MediaType.create(mediaType, charset)) ; }
/** * Parses the content type. It splits the string by semi-colon and finds the * other features such as the "q" quality factor. For a complete documentation * on how the parsing happens, see * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1</a>. * * @param contentType content type string * @return parsed media type */ static public MediaType parse(String contentType) { try { return MediaType.create(contentType) ; } catch (RuntimeException ex) { return null ; } }
public static ContentType create(String string) { if ( string == null ) return null ; ContentType ct = new ContentType(MediaType.create(string)) ; return ct ; }
public static ContentType create(String string) { if ( string == null ) return null ; ContentType ct = new ContentType(MediaType.create(string)) ; return ct ; }
public static String getCharsetForContentType(String contentType) { MediaType ct = MediaType.create(contentType) ; if ( ct.getCharset() != null ) return ct.getCharset() ; String mt = ct.getContentType() ; if ( contentTypeNTriples.equals(mt) ) return charsetUTF8 ; if ( contentTypeNTriplesAlt.equals(mt) ) return charsetASCII ; if ( contentTypeNQuads.equals(mt) ) return charsetUTF8 ; if ( contentTypeNQuadsAlt1.equals(mt) ) return charsetASCII ; if ( contentTypeNQuadsAlt2.equals(mt) ) return charsetASCII ; return charsetUTF8 ; }
public static String getCharsetForContentType(String contentType) { MediaType ct = MediaType.create(contentType) ; if ( ct.getCharset() != null ) return ct.getCharset() ; String mt = ct.getContentType() ; if ( contentTypeNTriples.equals(mt) ) return charsetUTF8 ; if ( contentTypeNTriplesAlt.equals(mt) ) return charsetASCII ; if ( contentTypeNQuads.equals(mt) ) return charsetUTF8 ; if ( contentTypeNQuadsAlt1.equals(mt) ) return charsetASCII ; if ( contentTypeNQuadsAlt2.equals(mt) ) return charsetASCII ; return charsetUTF8 ; }