org.eclipse.emf.ecore.resource.impl
Class BinaryResourceImpl

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      extended by org.eclipse.emf.common.notify.impl.NotifierImpl
          extended by org.eclipse.emf.ecore.resource.impl.ResourceImpl
              extended by org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl
All Implemented Interfaces:
Notifier, Resource, Resource.Internal

public class BinaryResourceImpl
extends ResourceImpl

An API for efficiently producing and consuming a compact binary serialization that's suitable for long term storage.

Since:
2.4

Nested Class Summary
static class BinaryResourceImpl.BinaryIO
           
static class BinaryResourceImpl.EObjectInputStream
           
static class BinaryResourceImpl.EObjectOutputStream
           
 
Nested classes/interfaces inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
ResourceImpl.ContentsEList<E extends java.lang.Object & EObject>, ResourceImpl.ModificationTrackingAdapter
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
BasicNotifierImpl.EAdapterList<E extends java.lang.Object & Adapter>, BasicNotifierImpl.EObservableAdapterList
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.resource.Resource
Resource.Diagnostic, Resource.Factory, Resource.Internal, Resource.IOWrappedException
 
Field Summary
static int DEFAULT_BUFFER_CAPACITY
          The default OPTION_BUFFER_CAPACITY capacity of the buffered stream used when saving or loading the resource content.
static java.lang.String OPTION_BUFFER_CAPACITY
          Specify the capacity of the buffered stream used when saving or loading the resource content.
static java.lang.String OPTION_STYLE_BINARY_DATE
          A Boolean save option to specify whether date values will be serialized using Date.getTime() rather than a string representation.
static java.lang.String OPTION_STYLE_BINARY_FLOATING_POINT
          A Boolean save option to specify whether float and double values are encoded using Float.floatToIntBits(float) and Double.doubleToLongBits(double) respectively, rather than a string representation.
static java.lang.String OPTION_STYLE_PROXY_ATTRIBUTES
          A Boolean save option to specify whether serialized proxies will include the serialization of their attribute values.
static java.lang.String OPTION_VERSION
          A save option to specify the BinaryResourceImpl.BinaryIO.Version to be used for the serialization.
 
Fields inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
contents, defaultDeleteOptions, defaultLoadOptions, defaultSaveOptions, errors, intrinsicIDToEObjectMap, isLoaded, isLoading, isModified, modificationTrackingAdapter, resourceSet, timeStamp, unloadingContents, uri, warnings
 
Fields inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, EDELIVER, eFlags, ELAST_NOTIFIER_FLAG
 
Fields inherited from interface org.eclipse.emf.ecore.resource.Resource
OPTION_CIPHER, OPTION_SAVE_ONLY_IF_CHANGED, OPTION_SAVE_ONLY_IF_CHANGED_FILE_BUFFER, OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER, OPTION_ZIP, RESOURCE__CONTENTS, RESOURCE__ERRORS, RESOURCE__IS_LOADED, RESOURCE__IS_MODIFIED, RESOURCE__IS_TRACKING_MODIFICATION, RESOURCE__RESOURCE_SET, RESOURCE__TIME_STAMP, RESOURCE__URI, RESOURCE__WARNINGS
 
Constructor Summary
BinaryResourceImpl()
           
BinaryResourceImpl(URI uri)
           
 
Method Summary
protected  void doLoad(java.io.InputStream inputStream, java.util.Map<?,?> options)
          Called to load the resource.
protected  void doSave(java.io.OutputStream outputStream, java.util.Map<?,?> options)
          Called to save the resource.
static int getBufferCapacity(java.util.Map<?,?> options)
          Extract the OPTION_BUFFER_CAPACITY from the options.
 
Methods inherited from class org.eclipse.emf.ecore.resource.impl.ResourceImpl
addModificationTrackingAdapters, attached, attachedHelper, basicSetResourceSet, createModificationTrackingAdapter, delete, detached, detachedHelper, doUnload, getAllContents, getAllProperContents, getAllProperContents, getContents, getDefaultURIConverter, getEObject, getEObject, getEObjectByID, getEObjectForURIFragmentRootSegment, getErrors, getIntrinsicIDToEObjectMap, getResourceSet, getTimeStamp, getURI, getURIConverter, getURIFragment, getURIFragmentRootSegment, getWarnings, handleLoadResponse, handleSaveResponse, isAttachedDetachedHelperRequired, isContentZipEntry, isLoaded, isLoading, isModified, isTrackingModification, load, load, mergeMaps, newContentZipEntry, removeModificationTrackingAdapters, save, save, saveOnlyIfChangedWithFileBuffer, saveOnlyIfChangedWithMemoryBuffer, setIntrinsicIDToEObjectMap, setLoaded, setModified, setTimeStamp, setTrackingModification, setURI, toKeyString, toString, unload, unloaded, useZip
 
Methods inherited from class org.eclipse.emf.common.notify.impl.NotifierImpl
eAdapters, eBasicAdapters, eDeliver, eSetDeliver
 
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 

Field Detail

OPTION_VERSION

public static final java.lang.String OPTION_VERSION
A save option to specify the BinaryResourceImpl.BinaryIO.Version to be used for the serialization.

Since:
2.7
See Also:
BinaryResourceImpl.BinaryIO.Version, Constant Field Values

OPTION_STYLE_BINARY_FLOATING_POINT

public static final java.lang.String OPTION_STYLE_BINARY_FLOATING_POINT
A Boolean save option to specify whether float and double values are encoded using Float.floatToIntBits(float) and Double.doubleToLongBits(double) respectively, rather than a string representation. The default is true. This style option is only supported for serializations with version 1.1 or higher.

Since:
2.7
See Also:
BinaryResourceImpl.BinaryIO.STYLE_BINARY_FLOATING_POINT, Constant Field Values

OPTION_STYLE_BINARY_DATE

public static final java.lang.String OPTION_STYLE_BINARY_DATE
A Boolean save option to specify whether date values will be serialized using Date.getTime() rather than a string representation. This style option is only supported for serializations with version 1.1 or higher. The default is false.

Since:
2.7
See Also:
BinaryResourceImpl.BinaryIO.STYLE_BINARY_DATE, Constant Field Values

OPTION_STYLE_PROXY_ATTRIBUTES

public static final java.lang.String OPTION_STYLE_PROXY_ATTRIBUTES
A Boolean save option to specify whether serialized proxies will include the serialization of their attribute values. This style option is only supported for serializations with version 1.1 or higher. The default is false.

Since:
2.7
See Also:
BinaryResourceImpl.BinaryIO.STYLE_PROXY_ATTRIBUTES, Constant Field Values

OPTION_BUFFER_CAPACITY

public static final java.lang.String OPTION_BUFFER_CAPACITY
Specify the capacity of the buffered stream used when saving or loading the resource content. The value must be an integer. If not specified, DEFAULT_BUFFER_CAPACITY is used. A value less than one disables the cache.

Since:
2.6
See Also:
Constant Field Values

DEFAULT_BUFFER_CAPACITY

public static final int DEFAULT_BUFFER_CAPACITY
The default OPTION_BUFFER_CAPACITY capacity of the buffered stream used when saving or loading the resource content.

Since:
2.6
See Also:
Constant Field Values
Constructor Detail

BinaryResourceImpl

public BinaryResourceImpl()

BinaryResourceImpl

public BinaryResourceImpl(URI uri)
Method Detail

getBufferCapacity

public static int getBufferCapacity(java.util.Map<?,?> options)
Extract the OPTION_BUFFER_CAPACITY from the options.

Parameters:
options - a map of options.
Returns:
the value associated with the OPTION_BUFFER_CAPACITY key in the options map.
Since:
2.6

doSave

protected void doSave(java.io.OutputStream outputStream,
                      java.util.Map<?,?> options)
               throws java.io.IOException
Description copied from class: ResourceImpl
Called to save the resource. This implementation throws an exception; clients must override it.

Overrides:
doSave in class ResourceImpl
Parameters:
outputStream - the stream
options - the save options.
Throws:
java.io.IOException

doLoad

protected void doLoad(java.io.InputStream inputStream,
                      java.util.Map<?,?> options)
               throws java.io.IOException
Description copied from class: ResourceImpl
Called to load the resource. This implementation throws an exception; clients must override it.

Overrides:
doLoad in class ResourceImpl
Parameters:
inputStream - the stream
options - the load options.
Throws:
java.io.IOException

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.