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

com.google.sitebricks.client.transport.XStreamXmlTransport Maven / Gradle / Ivy

There is a newer version: 0.8.11
Show newest version
package com.google.sitebricks.client.transport;

import com.google.inject.Inject;
import com.thoughtworks.xstream.XStream;

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

/**
 * @author Dhanji R. Prasanna ([email protected])
 */
class XStreamXmlTransport extends Xml {
  private final XStream xStream;

  @Inject
  public XStreamXmlTransport(XStream xStream) {
    this.xStream = xStream;
  }

  public  T in(InputStream in, Class type) throws IOException {
    return type.cast(xStream.fromXML(in));
  }

  public  void out(OutputStream out, Class type, T data) {
    xStream.toXML(data, out);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy