Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (C) 2012 Ness Computing, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.nesscomputing.httpclient.response;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import com.google.common.base.Objects;
import com.google.common.base.Throwables;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.type.TypeReference;
import com.nesscomputing.callback.Callback;
import com.nesscomputing.callback.CallbackRefusedException;
import com.nesscomputing.httpclient.HttpClientResponse;
import com.nesscomputing.httpclient.HttpClientResponseHandler;
import com.nesscomputing.logging.Log;
/**
* Accepts an incoming JSON data stream and converts it into objects on the fly. The JSON data stream must be structured in a special format:
*
* { "results": [ .... stream of data ],
* "success": true
* }
*
*
* No other fields must be present in the JSON object besides results and success and the success field must immediately follow
* the results field to mark its end.
*/
public class StreamedJsonContentConverter extends AbstractErrorHandlingContentConverter
{
private static final Log LOG = Log.findLog();
private static final TypeReference