本文整理汇总了Java中com.fasterxml.jackson.core.JsonEncoding.UTF8属性的典型用法代码示例。如果您正苦于以下问题:Java JsonEncoding.UTF8属性的具体用法?Java JsonEncoding.UTF8怎么用?Java JsonEncoding.UTF8使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.fasterxml.jackson.core.JsonEncoding
的用法示例。
在下文中一共展示了JsonEncoding.UTF8属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJsonEncoding
/**
* Determine the JSON encoding to use for the given content type.
* @param contentType the media type as requested by the caller
* @return the JSON encoding to use (never {@code null})
*/
protected JsonEncoding getJsonEncoding(MediaType contentType) {
if (contentType != null && contentType.getCharSet() != null) {
Charset charset = contentType.getCharSet();
for (JsonEncoding encoding : JsonEncoding.values()) {
if (charset.name().equals(encoding.getJavaName())) {
return encoding;
}
}
}
return JsonEncoding.UTF8;
}
开发者ID:JetBrains,项目名称:teamcity-hashicorp-vault-plugin,代码行数:16,代码来源:AbstractJackson2HttpMessageConverter.java
示例2: getJsonEncoding
/**
* Determine the JSON encoding to use for the given content type.
* @param contentType the MIME type from the MessageHeaders, if any
* @return the JSON encoding to use (never {@code null})
*/
protected JsonEncoding getJsonEncoding(MimeType contentType) {
if ((contentType != null) && (contentType.getCharSet() != null)) {
Charset charset = contentType.getCharSet();
for (JsonEncoding encoding : JsonEncoding.values()) {
if (charset.name().equals(encoding.getJavaName())) {
return encoding;
}
}
}
return JsonEncoding.UTF8;
}
示例3: getJsonEncoding
/**
* Determine the JSON encoding to use for the given content type.
* @param contentType the media type as requested by the caller
* @return the JSON encoding to use (never <code>null</code>)
*/
protected JsonEncoding getJsonEncoding(MediaType contentType) {
if (contentType != null && contentType.getCharSet() != null) {
Charset charset = contentType.getCharSet();
for (JsonEncoding encoding : JsonEncoding.values()) {
if (charset.name().equals(encoding.getJavaName())) {
return encoding;
}
}
}
return JsonEncoding.UTF8;
}
示例4: constructParser
public final JsonParser constructParser(int paramInt, ObjectCodec paramObjectCodec, BytesToNameCanonicalizer paramBytesToNameCanonicalizer, CharsToNameCanonicalizer paramCharsToNameCanonicalizer, boolean paramBoolean1, boolean paramBoolean2)
{
if ((detectEncoding() == JsonEncoding.UTF8) && (paramBoolean1))
{
BytesToNameCanonicalizer localBytesToNameCanonicalizer = paramBytesToNameCanonicalizer.makeChild(paramBoolean1, paramBoolean2);
return new UTF8StreamJsonParser(this._context, paramInt, this._in, paramObjectCodec, localBytesToNameCanonicalizer, this._inputBuffer, this._inputPtr, this._inputEnd, this._bufferRecyclable);
}
return new ReaderBasedJsonParser(this._context, paramInt, constructReader(), paramObjectCodec, paramCharsToNameCanonicalizer.makeChild(paramBoolean1, paramBoolean2));
}
示例5: getJsonEncoding
/**
* Determine the JSON encoding to use for the given content type.
*
* @param contentType
* the media type as requested by the caller
* @return the JSON encoding to use (never {@code null})
*/
protected JsonEncoding getJsonEncoding(MediaType contentType) {
if (contentType != null && contentType.getCharSet() != null) {
Charset charset = contentType.getCharSet();
for (JsonEncoding encoding : JsonEncoding.values()) {
if (charset.name()
.equals(encoding.getJavaName())) {
return encoding;
}
}
}
return JsonEncoding.UTF8;
}
示例6: getJsonEncoding
/**
* <br>
* 2013-10-25 下午12:29:58
*
* @param characterEncoding
* @return
*/
private JsonEncoding getJsonEncoding(String characterEncoding) {
for (JsonEncoding encoding : JsonEncoding.values()) {
if (characterEncoding.equals(encoding.getJavaName())) {
return encoding;
}
}
return JsonEncoding.UTF8;
}
示例7: getJsonEncoding
/**
* Determine the JSON encoding to use for the given content type.
*
* @param contentType the media type as requested by the caller
* @return the JSON encoding to use (never <code>null</code>)
*/
private JsonEncoding getJsonEncoding(MediaType contentType) {
if (contentType != null && contentType.getCharset() != null) {
Charset charset = contentType.getCharset();
for (JsonEncoding encoding : JsonEncoding.values()) {
if (charset.name().equals(encoding.getJavaName())) {
return encoding;
}
}
}
return JsonEncoding.UTF8;
}
示例8: _createReader
protected Reader _createReader(InputStream in, JsonEncoding enc, IOContext ctxt) throws IOException
{
if (enc == null) {
enc = JsonEncoding.UTF8;
}
// default to UTF-8 if encoding missing
if (enc == JsonEncoding.UTF8) {
boolean autoClose = ctxt.isResourceManaged() || isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE);
return new UTF8Reader(in, autoClose);
}
return new InputStreamReader(in, enc.getJavaName());
}
示例9: getEncoding
private JsonEncoding getEncoding(MediaType contentType) {
if (contentType != null && contentType.getCharSet() != null) {
Charset charset = contentType.getCharSet();
for (JsonEncoding encoding : JsonEncoding.values()) {
if (charset.name().equals(encoding.getJavaName())) {
return encoding;
}
}
}
return JsonEncoding.UTF8;
}
开发者ID:concentricsky,项目名称:android-viewer-for-khan-academy,代码行数:11,代码来源:MappingJacksonHttpMessageConverter.java
示例10: detectEncoding
public final JsonEncoding detectEncoding()
{
int i;
if (ensureLoaded(4))
{
int j = this._inputBuffer[this._inputPtr] << 24 | (0xFF & this._inputBuffer[(1 + this._inputPtr)]) << 16 | (0xFF & this._inputBuffer[(2 + this._inputPtr)]) << 8 | 0xFF & this._inputBuffer[(3 + this._inputPtr)];
if (handleBOM(j))
{
i = 1;
}
else if (checkUTF32(j))
{
i = 1;
}
else
{
boolean bool3 = checkUTF16(j >>> 16);
i = 0;
if (bool3)
i = 1;
}
}
else
{
boolean bool1 = ensureLoaded(2);
i = 0;
if (bool1)
{
boolean bool2 = checkUTF16((0xFF & this._inputBuffer[this._inputPtr]) << 8 | 0xFF & this._inputBuffer[(1 + this._inputPtr)]);
i = 0;
if (bool2)
i = 1;
}
}
JsonEncoding localJsonEncoding;
if (i == 0)
{
localJsonEncoding = JsonEncoding.UTF8;
}
else
{
switch (this._bytesPerChar)
{
default:
break;
case 1:
localJsonEncoding = JsonEncoding.UTF8;
break;
case 2:
if (this._bigEndian)
localJsonEncoding = JsonEncoding.UTF16_BE;
else
localJsonEncoding = JsonEncoding.UTF16_LE;
break;
case 4:
if (this._bigEndian)
localJsonEncoding = JsonEncoding.UTF32_BE;
else
localJsonEncoding = JsonEncoding.UTF32_LE;
break;
case 3:
}
throw new RuntimeException("Internal error");
}
this._context.setEncoding(localJsonEncoding);
return localJsonEncoding;
}
示例11: testCreateGenerator
@Test
public void testCreateGenerator() throws IOException {
JsonEncoding enc = JsonEncoding.UTF8;
JsonGenerator generator = factory.createGenerator(out, enc);
assertEquals(MessagePackGenerator.class, generator.getClass());
}
示例12: writeBackListToRowTable
public static String writeBackListToRowTable(String namespace, List lvo, final String[] ignoreName, ObjectMapper objectMapper) {
if(lvo == null || lvo.size() == 0) {
return "";
}
//TODO ignoreName
if(objectMapper == null) {
objectMapper = RmObjectMapper.getInstance();
}
JsonEncoding encoding = JsonEncoding.UTF8;
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));
StringBuilder result = new StringBuilder();
result.append("jQuery(function(){\n");
result.append("writeBackListToRowTable(");
result.append("'");
result.append(namespace);
result.append("'");
result.append(", \n");
try {
// 排除
SimpleFilterProvider fileter = new SimpleFilterProvider();
fileter.addFilter("executeFilter", SimpleBeanPropertyFilter.serializeAllExcept(ignoreName));
objectMapper.setFilters(fileter);
// // 仅包含
// SimpleFilterProvider fileter2 = new SimpleFilterProvider();
// fileter2.addFilter("includeFilter", SimpleBeanPropertyFilter.filterOutAllExcept(new String[] { "id", "quality" }));
// objectMapper.setFilters(fileter2);
// 设置日期格式化
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
SegmentedStringWriter sw = new SegmentedStringWriter(objectMapper.getFactory()._getBufferRecycler());
JsonGenerator generator = objectMapper.getFactory().createJsonGenerator(sw);
RmBeanSerializerFactory bidBeanFactory = RmBeanSerializerFactory.instance;
bidBeanFactory.setFilterId("executeFilter"); // 如果是仅包含这里填写 includeFilter
objectMapper.setSerializerFactory(bidBeanFactory);
objectMapper.writeValue(generator, lvo);
result.append( sw.getAndClear());
} catch (Exception e) {
throw new RuntimeException(e);
}
result.append("\n);");
result.append("\n});");
return result.toString();
}