Class Binary
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.artifactModel.representation.AbstractArtifactRepresentation
-
- net.ssehub.easy.instantiation.core.model.artifactModel.representation.Binary
-
- All Implemented Interfaces:
IArtifactChangedListener,IArtifactRepresentation,IStringValueProvider,IVilType
public class Binary extends AbstractArtifactRepresentation implements IArtifactChangedListener, IStringValueProvider
The binary representation of an artifact. Please note that this class is not an artifact by itself rather then a specific representation of an artifact.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
IStringValueProvider.StringComparator
-
-
Field Summary
Fields Modifier and Type Field Description static BinaryCONSTANT_EMPTYprivate byte[]dataprivate java.io.Filefile
-
Constructor Summary
Constructors Constructor Description Binary(boolean modifiable)Creates a new empty binary representation.Binary(java.io.File file, boolean modifiable)Creates a new binary representation fromfile.Binary(java.lang.String text, boolean modifiable)Creates a new binary representation fromfile.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidartifactChanged(java.lang.Object cause)Is called when the artifact was changed, e.g., to trigger a reanalysis of substructures.java.lang.StringgetStringValue(IStringValueProvider.StringComparator comparator)Returns the string value of this object.booleanisEmpty()Returns whether this artifact representation is empty.voidupdateContents()Updates the text contents.voidwrite(java.io.OutputStream out)Writes the data to the given output stream.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.artifactModel.representation.AbstractArtifactRepresentation
getListeners, isModifiable, setTriggerEnabled, triggerArtifactChanged
-
-
-
-
Field Detail
-
CONSTANT_EMPTY
public static final Binary CONSTANT_EMPTY
-
data
private byte[] data
-
file
private java.io.File file
-
-
Constructor Detail
-
Binary
public Binary(boolean modifiable)
Creates a new empty binary representation.- Parameters:
modifiable- whether this representation shall be modifiable
-
Binary
public Binary(java.lang.String text, boolean modifiable) throws VilExceptionCreates a new binary representation fromfile.- Parameters:
text- the text to construct the representation frommodifiable- whether this representation shall be modifiable- Throws:
VilException- in case that reading fails for some reason
-
Binary
public Binary(java.io.File file, boolean modifiable) throws VilExceptionCreates a new binary representation fromfile.- Parameters:
file- the file to be considered as inputmodifiable- whether this representation shall be modifiable- Throws:
VilException- in case that reading fails for some reason
-
-
Method Detail
-
updateContents
public void updateContents() throws VilExceptionUpdates the text contents.- Specified by:
updateContentsin interfaceIArtifactRepresentation- Throws:
VilException- in case that reading fails for some reason
-
isEmpty
public boolean isEmpty()
Description copied from interface:IArtifactRepresentationReturns whether this artifact representation is empty.- Specified by:
isEmptyin interfaceIArtifactRepresentation- Returns:
trueif it is empty,falseelse
-
artifactChanged
public void artifactChanged(java.lang.Object cause) throws VilExceptionDescription copied from interface:IArtifactChangedListenerIs called when the artifact was changed, e.g., to trigger a reanalysis of substructures.- Specified by:
artifactChangedin interfaceIArtifactChangedListener- Parameters:
cause- the cause for the change, e.g., an artifact representation- Throws:
VilException- in case that the required operations fail for some reason
-
write
public void write(java.io.OutputStream out) throws java.io.IOExceptionWrites the data to the given output stream.- Parameters:
out- the target output stream- Throws:
java.io.IOException- in case of I/O problems
-
getStringValue
public java.lang.String getStringValue(IStringValueProvider.StringComparator comparator)
Description copied from interface:IStringValueProviderReturns the string value of this object.- Specified by:
getStringValuein interfaceIStringValueProvider- Parameters:
comparator- if the sequence of elements, e.g., in case of collections, shall be ordered according to the comparator, null if the original sequence shall be returned- Returns:
- the string value
-
-