本文整理匯總了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);