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

org.ssf4j.xstream.XStreamDeserializer Maven / Gradle / Ivy

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

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

import org.ssf4j.Deserializer;

import com.thoughtworks.xstream.XStream;

public class XStreamDeserializer implements Deserializer {

	protected XStream xstream;
	protected Class type;
	protected InputStream in;
	
	public XStreamDeserializer(XStream xstream, InputStream in, Class type) {
		this.xstream = xstream != null ? xstream : new XStream();
		this.in = in;
		this.type = type;
	}
	
	@Override
	public T read() throws IOException {
		return type.cast(xstream.fromXML(in));
	}

	@Override
	public void close() throws IOException {
		in.close();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy