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

org.ssf4j.jackson.JacksonDeserializer Maven / Gradle / Ivy

There is a newer version: 0.4
Show newest version
package org.ssf4j.jackson;

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

import org.ssf4j.Deserializer;

import com.fasterxml.jackson.databind.ObjectMapper;

public class JacksonDeserializer implements Deserializer {

	protected InputStream in;
	protected Class type;
	protected ObjectMapper mapper;
	
	public JacksonDeserializer(InputStream in, ObjectMapper mapper, Class type) {
		this.in = in;
		this.type = type;
		this.mapper = mapper != null ? mapper : new ObjectMapper();
	}
	
	@Override
	public void close() throws IOException {
		in.close();
	}

	@Override
	public T read() throws IOException {
		return mapper.readValue(in, type);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy