Search in sources :

Example 6 with BytesContentStorage

use of org.jkiss.dbeaver.model.data.storage.BytesContentStorage in project dbeaver by serge-rider.

the class DBDDocumentContentProxy method updateDocument.

@Override
public void updateDocument(@NotNull DBRProgressMonitor monitor, @NotNull InputStream stream, Charset charset) throws DBException {
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ContentUtils.copyStreams(stream, -1, baos, monitor);
        content.updateContents(monitor, new BytesContentStorage(baos.toByteArray(), charset));
        document.updateDocument(monitor, new ByteArrayInputStream(baos.toByteArray()), charset);
    } catch (IOException e) {
        throw new DBException("Error transforming XML document", e);
    }
}
Also used : DBException(org.jkiss.dbeaver.DBException) BytesContentStorage(org.jkiss.dbeaver.model.data.storage.BytesContentStorage)

Aggregations

BytesContentStorage (org.jkiss.dbeaver.model.data.storage.BytesContentStorage)6 DBException (org.jkiss.dbeaver.DBException)4 IOException (java.io.IOException)2 ByteBuffer (java.nio.ByteBuffer)2 DBDContent (org.jkiss.dbeaver.model.data.DBDContent)2 StringContentStorage (org.jkiss.dbeaver.model.data.storage.StringContentStorage)2 VoidProgressMonitor (org.jkiss.dbeaver.model.runtime.VoidProgressMonitor)2 BinaryContent (org.jkiss.dbeaver.ui.editors.binary.BinaryContent)2