Class VdmMediaEntity<EntityT>
java.lang.Object
com.sap.cloud.sdk.datamodel.odata.helper.VdmObject<EntityT>
com.sap.cloud.sdk.datamodel.odata.helper.VdmEntity<EntityT>
com.sap.cloud.sdk.datamodel.odata.helper.VdmMediaEntity<EntityT>
- Type Parameters:
EntityT
- The specific entity type.
Represents a media entity which exposes additional data under a
$value
endpoint.-
Field Summary
Fields inherited from class com.sap.cloud.sdk.datamodel.odata.helper.VdmObject
changedOriginalFields
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
Get the binary data stream (file) from this media entity.int
hashCode()
Methods inherited from class com.sap.cloud.sdk.datamodel.odata.helper.VdmEntity
attachToService, fetchFieldAsList, fetchFieldAsSingle, getDefaultServicePath, getDestinationForFetch, getEntityCollection, getServicePathForFetch, getVersionIdentifier, setDestinationForFetch, setServicePathForFetch, setVersionIdentifier
Methods inherited from class com.sap.cloud.sdk.datamodel.odata.helper.VdmObject
fromMap, getChangedFields, getCustomField, getCustomField, getCustomFieldNames, getCustomFields, getKey, getSetOfCustomFields, getSetOfFields, getSetOfNavigationProperties, getType, hasCustomField, hasCustomField, rememberChangedField, resetChangedFields, setCustomField, setCustomField, toMap, toMapOfCustomFields, toMapOfFields, toMapOfNavigationProperties, toString
-
Constructor Details
-
VdmMediaEntity
public VdmMediaEntity()
-
-
Method Details
-
fetchMediaStream
Get the binary data stream (file) from this media entity. Perform this operation after retrieving the entity object from the OData service.Alternatively, you can use this method to only retrieve the media resource without requesting the entity data. Build this entity via its
.builder()
and useVdmEntity.attachToService(String, Destination)
to declare a service path and destination to request the media resource from. You can obtain the service path from the<ServiceClass>#DEFAULT_SERVICE_PATH
, e.g.BusinessPartnerServiceBusinessPartnerService.DEFAULT_SERVICE_PATH
Please ensure this stream is closed after usage. The below example achieves this using try-with-resources:
try( InputStream content = entity.fetchMediaStream() ) { // do something with the content here }
- Returns:
- File content as an
InputStream
. - Throws:
ODataException
- if the request could not be sent or the OData service responded with an error.
-
equals
-
canEqual
-
hashCode
public int hashCode()
-