com.google.sitebricks.client.transport.SimpleTextTransport Maven / Gradle / Ivy
package com.google.sitebricks.client.transport;
import org.apache.commons.io.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* @author Dhanji R. Prasanna ([email protected])
*/
class SimpleTextTransport extends Text {
public T in(InputStream in, Class type) throws IOException {
return type.cast(IOUtils.toString(in));
}
public void out(OutputStream out, Class type, T data) {
try {
IOUtils.write(data.toString(), out);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}