本文整理汇总了Java中org.eclipse.emf.ecore.resource.URIConverter.OPTION_RESPONSE属性的典型用法代码示例。如果您正苦于以下问题:Java URIConverter.OPTION_RESPONSE属性的具体用法?Java URIConverter.OPTION_RESPONSE怎么用?Java URIConverter.OPTION_RESPONSE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.emf.ecore.resource.URIConverter
的用法示例。
在下文中一共展示了URIConverter.OPTION_RESPONSE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: save
public void save(Map<?, ?> options) throws IOException
{
Object saveOnlyIfChanged =
options != null && options.containsKey(OPTION_SAVE_ONLY_IF_CHANGED) ?
options.get(OPTION_SAVE_ONLY_IF_CHANGED) :
defaultSaveOptions != null ?
defaultSaveOptions.get(OPTION_SAVE_ONLY_IF_CHANGED) :
null;
if (OPTION_SAVE_ONLY_IF_CHANGED_FILE_BUFFER.equals(saveOnlyIfChanged))
{
saveOnlyIfChangedWithFileBuffer(options);
}
else if (OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER.equals(saveOnlyIfChanged))
{
saveOnlyIfChangedWithMemoryBuffer(options);
}
else
{
Map<?, ?> response = options == null ? null : (Map<?, ?>)options.get(URIConverter.OPTION_RESPONSE);
if (response == null)
{
response = new HashMap<Object, Object>();
}
URIConverter uriConverter = getURIConverter();
ExtensibleURIConverterImpl.OptionsMap effectiveOptions = new ExtensibleURIConverterImpl.OptionsMap(URIConverter.OPTION_RESPONSE, response, options, defaultSaveOptions);
OutputStream outputStream = uriConverter.createOutputStream(getURI(), effectiveOptions);
try
{
save(outputStream, options);
}
finally
{
outputStream.close();
handleSaveResponse(response, effectiveOptions);
}
}
}
示例2: load
public void load(Map<?, ?> options) throws IOException
{
if (!isLoaded)
{
URIConverter uriConverter = getURIConverter();
Map<?, ?> response = options == null ? null : (Map<?, ?>)options.get(URIConverter.OPTION_RESPONSE);
if (response == null)
{
response = new HashMap<Object, Object>();
}
// If an input stream can't be created, ensure that the resource is still considered loaded after the failure,
// and do all the same processing we'd do if we actually were able to create a valid input stream.
//
InputStream inputStream = null;
ExtensibleURIConverterImpl.OptionsMap effectiveOptions = new ExtensibleURIConverterImpl.OptionsMap(URIConverter.OPTION_RESPONSE, response, options, defaultLoadOptions);
try
{
inputStream =
uriConverter.createInputStream
(getURI(),
effectiveOptions);
}
catch (IOException exception)
{
Notification notification = setLoaded(true);
isLoading = true;
if (errors != null)
{
errors.clear();
}
if (warnings != null)
{
warnings.clear();
}
isLoading = false;
if (notification != null)
{
eNotify(notification);
}
setModified(false);
throw exception;
}
try
{
load(inputStream, options);
}
finally
{
inputStream.close();
handleLoadResponse(response, effectiveOptions);
}
}
}