本文整理汇总了Java中org.eclipse.xtext.resource.persistence.ResourceStorageWritable类的典型用法代码示例。如果您正苦于以下问题:Java ResourceStorageWritable类的具体用法?Java ResourceStorageWritable怎么用?Java ResourceStorageWritable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResourceStorageWritable类属于org.eclipse.xtext.resource.persistence包,在下文中一共展示了ResourceStorageWritable类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveResource
import org.eclipse.xtext.resource.persistence.ResourceStorageWritable; //导入依赖的package包/类
@Override
public void saveResource(final StorageAwareResource resource, final IFileSystemAccessExtension3 fsa) {
final String path = this.computeOutputPath(resource);
final ResourceStorageFacade.MyByteArrayOutputStream bout = new ResourceStorageFacade.MyByteArrayOutputStream();
final ResourceStorageWritable outStream = this.createResourceStorageWritable(bout);
try {
outStream.writeResource(resource);
} catch (final Throwable _t) {
if (_t instanceof IOException) {
final IOException e = (IOException)_t;
URI _uRI = resource.getURI();
String _plus = ("Cannot write storage for " + _uRI);
ResourceStorageFacade.LOG.warn(_plus, e);
return;
} else {
throw Exceptions.sneakyThrow(_t);
}
}
byte[] _byteArray = bout.toByteArray();
int _length = bout.length();
ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray, 0, _length);
fsa.generateFile(path, _byteArrayInputStream);
}
示例2: testPortableReferenceDescriptions
import org.eclipse.xtext.resource.persistence.ResourceStorageWritable; //导入依赖的package包/类
@Test
public void testPortableReferenceDescriptions() {
try {
final XtextResourceSet resourceSet = this.<XtextResourceSet>get(XtextResourceSet.class);
Resource _createResource = resourceSet.createResource(URI.createURI("hubba:/bubba.langatestlanguage"));
final StorageAwareResource resourceA = ((StorageAwareResource) _createResource);
Resource _createResource_1 = resourceSet.createResource(URI.createURI("hubba:/bubba2.langatestlanguage"));
final StorageAwareResource resourceB = ((StorageAwareResource) _createResource_1);
StringConcatenation _builder = new StringConcatenation();
_builder.append("type B");
_builder.newLine();
resourceB.load(this.getAsStream(_builder.toString()), null);
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("import \'hubba:/bubba2.langatestlanguage\'");
_builder_1.newLine();
_builder_1.newLine();
_builder_1.append("type A extends B");
_builder_1.newLine();
resourceA.load(this.getAsStream(_builder_1.toString()), null);
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
final ResourceStorageWritable writable = resourceA.getResourceStorageFacade().createResourceStorageWritable(bout);
writable.writeResource(resourceA);
byte[] _byteArray = bout.toByteArray();
ByteArrayInputStream _byteArrayInputStream = new ByteArrayInputStream(_byteArray);
final ResourceStorageLoadable loadable = resourceA.getResourceStorageFacade().createResourceStorageLoadable(_byteArrayInputStream);
Resource _createResource_2 = resourceSet.createResource(URI.createURI("hubba:/bubba3.langatestlanguage"));
final StorageAwareResource resourceC = ((StorageAwareResource) _createResource_2);
resourceC.loadFromStorage(loadable);
final IReferenceDescription refDesc = IterableExtensions.<IReferenceDescription>head(resourceC.getResourceDescription().getReferenceDescriptions());
EObject _head = IterableExtensions.<EObject>head(resourceB.getContents());
Assert.assertSame(IterableExtensions.<Type>head(((Main) _head).getTypes()), resourceSet.getEObject(refDesc.getTargetEObjectUri(), false));
EObject _head_1 = IterableExtensions.<EObject>head(resourceC.getContents());
Assert.assertSame(IterableExtensions.<Type>head(((Main) _head_1).getTypes()), resourceSet.getEObject(refDesc.getSourceEObjectUri(), false));
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例3: createResourceStorageWritable
import org.eclipse.xtext.resource.persistence.ResourceStorageWritable; //导入依赖的package包/类
@Override
public ResourceStorageWritable createResourceStorageWritable(final OutputStream out) {
boolean _isStoreNodeModel = this.isStoreNodeModel();
return new BatchLinkableResourceStorageWritable(out, _isStoreNodeModel);
}
示例4: createResourceStorageWritable
import org.eclipse.xtext.resource.persistence.ResourceStorageWritable; //导入依赖的package包/类
@Override
public ResourceStorageWritable createResourceStorageWritable(final OutputStream out) {
boolean _isStoreNodeModel = this.isStoreNodeModel();
return new ResourceStorageWritable(out, _isStoreNodeModel);
}
示例5: createResourceStorageWritable
import org.eclipse.xtext.resource.persistence.ResourceStorageWritable; //导入依赖的package包/类
@Override
public ResourceStorageWritable createResourceStorageWritable(final OutputStream out) {
return new DirectLinkingResourceStorageWritable(out, isStoreNodeModel());
}
示例6: createResourceStorageWritable
import org.eclipse.xtext.resource.persistence.ResourceStorageWritable; //导入依赖的package包/类
/**
* Creates a fresh ResourceStorageWritable wrapping the given OutputStream
*/
public abstract ResourceStorageWritable createResourceStorageWritable(final OutputStream outputStream);