Search in sources :

Example 1 with TalendFileResourceImpl

use of org.talend.designer.core.model.utils.emf.talendfile.util.TalendFileResourceImpl in project tdi-studio-se by Talend.

the class MetadataEmfFactory method getOutputStream.

@SuppressWarnings("unchecked")
public OutputStream getOutputStream() throws IOException {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    //$NON-NLS-1$
    URI uri = URI.createURI("");
    Resource res = new TalendFileResourceImpl(uri);
    res.getContents().add(metadataType);
    res.save(out, null);
    return out;
}
Also used : TalendFileResourceImpl(org.talend.designer.core.model.utils.emf.talendfile.util.TalendFileResourceImpl) Resource(org.eclipse.emf.ecore.resource.Resource) ByteArrayOutputStream(java.io.ByteArrayOutputStream) URI(org.eclipse.emf.common.util.URI)

Example 2 with TalendFileResourceImpl

use of org.talend.designer.core.model.utils.emf.talendfile.util.TalendFileResourceImpl in project tdi-studio-se by Talend.

the class MetadataEmfFactory method setInputStream.

public void setInputStream(final InputStream istream) throws IOException {
    //$NON-NLS-1$
    URI uri = URI.createURI("");
    TalendFilePackage.eINSTANCE.getNsURI();
    Resource res = new TalendFileResourceImpl(uri);
    res.load(istream, null);
    setMetadataType((MetadataType) res.getContents().get(0));
}
Also used : TalendFileResourceImpl(org.talend.designer.core.model.utils.emf.talendfile.util.TalendFileResourceImpl) Resource(org.eclipse.emf.ecore.resource.Resource) URI(org.eclipse.emf.common.util.URI)

Aggregations

URI (org.eclipse.emf.common.util.URI)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 TalendFileResourceImpl (org.talend.designer.core.model.utils.emf.talendfile.util.TalendFileResourceImpl)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1