当前位置: 首页>>代码示例>>Java>>正文


Java JsonIOException.getMessage方法代码示例

本文整理汇总了Java中com.google.gson.JsonIOException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java JsonIOException.getMessage方法的具体用法?Java JsonIOException.getMessage怎么用?Java JsonIOException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gson.JsonIOException的用法示例。


在下文中一共展示了JsonIOException.getMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeInternal

import com.google.gson.JsonIOException; //导入方法依赖的package包/类
protected void writeInternal(Object o, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException {
  
  
  Charset charset = this.getCharset(outputMessage.getHeaders());
  OutputStreamWriter writer = new OutputStreamWriter(outputMessage.getBody(), charset);
  
  try {
    if(this.jsonPrefix != null) {
      writer.append(this.jsonPrefix);
    }
    
    this.gson.toJson(o, writer);
    
    writer.close();
  } catch (JsonIOException var7) {
    throw new HttpMessageNotWritableException("Could not write JSON: " + var7.getMessage(), var7);
  }
}
 
开发者ID:Huawei,项目名称:Server_Management_Common_eSightApi,代码行数:19,代码来源:GsonHttpMessageConverter.java

示例2: writeInternal

import com.google.gson.JsonIOException; //导入方法依赖的package包/类
@Override
protected void writeInternal(Object o, Type type, HttpOutputMessage outputMessage)
    throws IOException, HttpMessageNotWritableException {
    Charset charset = getCharset(outputMessage.getHeaders());

    try (OutputStreamWriter writer = new OutputStreamWriter(outputMessage.getBody(), charset)) {
        if (ignoreType) {
            gsonForWriter.toJson(o, writer);
            return;
        }

        if (type != null) {
            gsonForWriter.toJson(o, type, writer);
            return;
        }

        gsonForWriter.toJson(o, writer);
    } catch (JsonIOException ex) {
        throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
    }
}
 
开发者ID:FlowCI,项目名称:flow-platform,代码行数:22,代码来源:RawGsonMessageConverter.java

示例3: writeInternal

import com.google.gson.JsonIOException; //导入方法依赖的package包/类
@Override
protected void writeInternal(Object o, Type type, HttpOutputMessage outputMessage)
		throws IOException, HttpMessageNotWritableException {

	Charset charset = getCharset(outputMessage.getHeaders());
	OutputStreamWriter writer = new OutputStreamWriter(outputMessage.getBody(), charset);
	try {
		if (this.jsonPrefix != null) {
			writer.append(this.jsonPrefix);
		}
		if (type != null) {
			this.gson.toJson(o, type, writer);
		}
		else {
			this.gson.toJson(o, writer);
		}
		writer.close();
	}
	catch (JsonIOException ex) {
		throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:GsonHttpMessageConverter.java

示例4: writeInternal

import com.google.gson.JsonIOException; //导入方法依赖的package包/类
@Override
protected void writeInternal(Object o, HttpOutputMessage outputMessage)
		throws IOException, HttpMessageNotWritableException {
	
	OutputStreamWriter writer = new OutputStreamWriter(outputMessage.getBody(), getCharset(outputMessage.getHeaders()));
	
	try {
		if (this.prefixJson) {
			writer.append("{} && ");
		}
		Type typeOfSrc = getType();
		if (typeOfSrc != null) {
			this.gson.toJson(o, typeOfSrc, writer);
		} else {
			this.gson.toJson(o, writer);
		}
		writer.close();
	} catch(JsonIOException  ex) {
		throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
	}	
}
 
开发者ID:bestarandyan,项目名称:ShoppingMall,代码行数:22,代码来源:GsonHttpMessageConverter.java

示例5: writeInternal

import com.google.gson.JsonIOException; //导入方法依赖的package包/类
@Override
protected void writeInternal( Object o, HttpOutputMessage outputMessage )
        throws IOException, HttpMessageNotWritableException{

    OutputStreamWriter writer = new OutputStreamWriter( outputMessage.getBody(), getCharset( outputMessage.getHeaders() ) );

    try{
        if( this.prefixJson ){
            writer.append( "{} && " );
        }
        Type typeOfSrc = getType();
        if( typeOfSrc != null ){
            this.gson.toJson( o, typeOfSrc, writer );
        }
        else{
            this.gson.toJson( o, writer );
        }
        writer.close();
    }
    catch( JsonIOException ex ){
        throw new HttpMessageNotWritableException( "Could not write JSON: " + ex.getMessage(), ex );
    }
}
 
开发者ID:zutnop,项目名称:telekom-workflow-engine,代码行数:24,代码来源:GsonHttpMessageConverterForSpring3.java


注:本文中的com.google.gson.JsonIOException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。