当前位置: 首页>>代码示例>>Java>>正文


Java ResourceStorageWritable类代码示例

本文整理汇总了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);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:24,代码来源:ResourceStorageFacade.java

示例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);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:38,代码来源:PortableURIsTest.java

示例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);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:6,代码来源:BatchLinkableResourceStorageFacade.java

示例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);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:6,代码来源:ResourceStorageFacade.java

示例5: createResourceStorageWritable

import org.eclipse.xtext.resource.persistence.ResourceStorageWritable; //导入依赖的package包/类
@Override
public ResourceStorageWritable createResourceStorageWritable(final OutputStream out) {
  return new DirectLinkingResourceStorageWritable(out, isStoreNodeModel());
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:5,代码来源:DirectLinkingResourceStorageFacade.java

示例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);
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:IResourceStorageFacade.java


注:本文中的org.eclipse.xtext.resource.persistence.ResourceStorageWritable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。