本文整理匯總了Java中com.epam.reportportal.apache.http.entity.ContentType.parse方法的典型用法代碼示例。如果您正苦於以下問題:Java ContentType.parse方法的具體用法?Java ContentType.parse怎麽用?Java ContentType.parse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.epam.reportportal.apache.http.entity.ContentType
的用法示例。
在下文中一共展示了ContentType.parse方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testParse
import com.epam.reportportal.apache.http.entity.ContentType; //導入方法依賴的package包/類
@Test
public void testParse() throws Exception {
final ContentType contentType = ContentType.parse("text/plain; charset=\"ascii\"");
Assert.assertEquals("text/plain", contentType.getMimeType());
Assert.assertEquals("US-ASCII", contentType.getCharset().name());
Assert.assertEquals("text/plain; charset=ascii", contentType.toString());
}
示例2: testParseMultiparam
import com.epam.reportportal.apache.http.entity.ContentType; //導入方法依賴的package包/類
@Test
public void testParseMultiparam() throws Exception {
final ContentType contentType = ContentType.parse("text/plain; charset=\"ascii\"; " +
"p0 ; p1 = \"blah-blah\" ; p2 = \" yada yada \" ");
Assert.assertEquals("text/plain", contentType.getMimeType());
Assert.assertEquals("US-ASCII", contentType.getCharset().name());
Assert.assertEquals("text/plain; charset=ascii; p0; p1=blah-blah; p2=\" yada yada \"",
contentType.toString());
Assert.assertEquals(null, contentType.getParameter("p0"));
Assert.assertEquals("blah-blah", contentType.getParameter("p1"));
Assert.assertEquals(" yada yada ", contentType.getParameter("p2"));
Assert.assertEquals(null, contentType.getParameter("p3"));
}
示例3: AbstractContentBody
import com.epam.reportportal.apache.http.entity.ContentType; //導入方法依賴的package包/類
/**
* @deprecated (4.3) use {@link AbstractContentBody#AbstractContentBody(ContentType)}
*/
@Deprecated
public AbstractContentBody(final String mimeType) {
this(ContentType.parse(mimeType));
}
示例4: testParseEmptyCharset
import com.epam.reportportal.apache.http.entity.ContentType; //導入方法依賴的package包/類
@Test
public void testParseEmptyCharset() throws Exception {
final ContentType contentType = ContentType.parse("text/plain; charset=\" \"");
Assert.assertEquals("text/plain", contentType.getMimeType());
Assert.assertEquals(null, contentType.getCharset());
}