de.akquinet.jbosscc.guttenbase.export.ExportDumpSqlXML Maven / Gradle / Ivy
The newest version!
package de.akquinet.jbosscc.guttenbase.export;
import de.akquinet.jbosscc.guttenbase.connector.GuttenBaseException;
import org.apache.commons.io.IOUtils;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.sql.SQLXML;
/**
* Since XML data may be quite big. we do not load them into memory completely,
* but read them in chunks and write the data to the output stream in a loop.
*
*
* © 2012-2034 akquinet tech@spree
*
*
* @author M. Dahm
*/
public class ExportDumpSqlXML extends AbstractExportDumpObject implements SQLXML {
private static final long serialVersionUID = 1L;
public ExportDumpSqlXML() {
this(null);
}
public ExportDumpSqlXML(final InputStream inputStream) {
super(inputStream);
}
@Override
public Reader getCharacterStream() {
return new InputStreamReader(getBinaryStream());
}
@Override
public OutputStream setBinaryStream() {
throw new UnsupportedOperationException();
}
@Override
public Writer setCharacterStream() {
throw new UnsupportedOperationException();
}
@Override
public String getString() {
try {
return IOUtils.toString(getBinaryStream(), StandardCharsets.UTF_8);
} catch (final IOException e) {
throw new GuttenBaseException("getString", e);
}
}
@Override
public void setString(final String value) {
throw new UnsupportedOperationException();
}
@Override
public T getSource(final Class sourceClass) {
throw new UnsupportedOperationException();
}
@Override
public T setResult(final Class resultClass) {
throw new UnsupportedOperationException();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy