當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。