Class BinariesApiImpl
java.lang.Object
com.cumulocity.sdk.client.inventory.BinariesApiImpl
- All Implemented Interfaces:
BinariesApi
-
Constructor Summary
ConstructorDescriptionBinariesApiImpl
(RestConnector restConnector, InventoryRepresentation inventoryRepresentation) -
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteFile
(GId containerId) Remove a managed object and its stored file by a given ID.downloadFile
(GId id) Download a stored file (managed object) by a given ID.replaceFile
(GId containerId, String contentType, InputStream fileStream) Upload and replace the attached file (binary) of a specific managed object by a given ID.uploadFile
(ManagedObjectRepresentation container, byte[] bytes) Upload a file (binary) with content-type of "application/octet-stream" (default).uploadFile
(ManagedObjectRepresentation container, byte[] bytes, jakarta.ws.rs.core.MediaType mediaType) Upload a file (binary) with custom content-type.uploadFile
(ManagedObjectRepresentation container, InputStream inputStream) Upload a file (binary) with content-type of "application/octet-stream" (default).uploadFile
(ManagedObjectRepresentation container, InputStream inputStream, jakarta.ws.rs.core.MediaType mediaType) Upload a file (binary) with custom content-type.
-
Constructor Details
-
BinariesApiImpl
public BinariesApiImpl(RestConnector restConnector, InventoryRepresentation inventoryRepresentation)
-
-
Method Details
-
uploadFile
public ManagedObjectRepresentation uploadFile(ManagedObjectRepresentation container, byte[] bytes) throws SDKException Description copied from interface:BinariesApi
Upload a file (binary) with content-type of "application/octet-stream" (default).- Specified by:
uploadFile
in interfaceBinariesApi
- Parameters:
container
- ManagedObjectRepresentation with binary metadatabytes
- file (binary) to be uploaded- Returns:
- ManagedObjectRepresentation with binary metadata
- Throws:
SDKException
- if upload fails
-
uploadFile
public ManagedObjectRepresentation uploadFile(ManagedObjectRepresentation container, byte[] bytes, jakarta.ws.rs.core.MediaType mediaType) throws SDKException Description copied from interface:BinariesApi
Upload a file (binary) with custom content-type.- Specified by:
uploadFile
in interfaceBinariesApi
- Parameters:
container
- ManagedObjectRepresentation with binary metadatabytes
- file (binary) to be uploadedmediaType
- content-type of file (binary)- Returns:
- ManagedObjectRepresentation with binary metadata
- Throws:
SDKException
- if upload fails
-
uploadFile
public ManagedObjectRepresentation uploadFile(ManagedObjectRepresentation container, InputStream inputStream) throws SDKException Description copied from interface:BinariesApi
Upload a file (binary) with content-type of "application/octet-stream" (default).- Specified by:
uploadFile
in interfaceBinariesApi
- Parameters:
container
- ManagedObjectRepresentation with binary metadatainputStream
- file (binary) to be uploaded- Returns:
- ManagedObjectRepresentation with binary metadata
- Throws:
SDKException
- if upload fails
-
uploadFile
public ManagedObjectRepresentation uploadFile(ManagedObjectRepresentation container, InputStream inputStream, jakarta.ws.rs.core.MediaType mediaType) throws SDKException Description copied from interface:BinariesApi
Upload a file (binary) with custom content-type.- Specified by:
uploadFile
in interfaceBinariesApi
- Parameters:
container
- ManagedObjectRepresentation with binary metadatainputStream
- file (binary) to be uploadedmediaType
- content-type of file (binary)- Returns:
- ManagedObjectRepresentation with binary metadata
- Throws:
SDKException
- if upload fails
-
replaceFile
public ManagedObjectRepresentation replaceFile(GId containerId, String contentType, InputStream fileStream) throws SDKException Description copied from interface:BinariesApi
Upload and replace the attached file (binary) of a specific managed object by a given ID.- Specified by:
replaceFile
in interfaceBinariesApi
- Parameters:
containerId
- ID of managed objectcontentType
- content-type of file (binary)fileStream
- file (binary) to be uploaded- Returns:
- ManagedObjectRepresentation with binary metadata
- Throws:
SDKException
- if upload fails
-
deleteFile
Description copied from interface:BinariesApi
Remove a managed object and its stored file by a given ID.- Specified by:
deleteFile
in interfaceBinariesApi
- Parameters:
containerId
- ID of managed object- Throws:
SDKException
- if delete fails
-
downloadFile
Description copied from interface:BinariesApi
Download a stored file (managed object) by a given ID.- Specified by:
downloadFile
in interfaceBinariesApi
- Parameters:
id
- ID of managed object- Returns:
- file (binary)
- Throws:
SDKException
- if download fails
-