All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jdroid.java.http.okhttp.ParseCommand Maven / Gradle / Ivy

The newest version!
package com.jdroid.java.http.okhttp;

import com.jdroid.java.exception.UnexpectedException;
import com.jdroid.java.http.parser.Parser;

import java.io.IOException;
import java.io.InputStream;

public class ParseCommand extends OkHttpCommand {

	private Parser parser;

	public ParseCommand(Parser parser) {
		this.parser = parser;
	}

	@Override
	protected Object doExecute(InputStream inputStream) throws IOException {
		try {
			return parser.parse(inputStream);
		} catch (UnexpectedException e) {
			Throwable throwable = e.getCause();
			if (throwable instanceof IOException) {
				throw (IOException)throwable;
			} else {
				throw e;
			}
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy