Class MemoryBinaryStorageSvcImpl

java.lang.Object
ca.uhn.fhir.jpa.binary.svc.BaseBinaryStorageSvcImpl
ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl
All Implemented Interfaces:
IBinaryStorageSvc

Purely in-memory implementation of binary storage service. This is really only appropriate for testing, since it doesn't persist anywhere and is limited by the amount of available RAM.
  • Constructor Details

  • Method Details

    • storeBlob

      @Nonnull public StoredDetails storeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobIdOrNull, String theContentType, InputStream theInputStream, ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) throws IOException
      Description copied from interface: IBinaryStorageSvc
      Store a new binary blob
      Specified by:
      storeBlob in interface IBinaryStorageSvc
      Parameters:
      theResourceId - The resource ID that owns this blob. Note that it should not be possible to retrieve a blob without both the resource ID and the blob ID being correct.
      theBlobIdOrNull - If set, forces
      theContentType - The content type to associate with this blob
      theInputStream - An InputStream to read from. This method should close the stream when it has been fully consumed.
      theRequestDetails - The operation request details.
      Returns:
      Returns details about the stored data
      Throws:
      IOException
    • fetchBlobDetails

      public StoredDetails fetchBlobDetails(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
      Specified by:
      fetchBlobDetails in interface IBinaryStorageSvc
    • writeBlob

      public boolean writeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId, OutputStream theOutputStream) throws IOException
      Specified by:
      writeBlob in interface IBinaryStorageSvc
      Returns:
      Returns true if the blob was found and written, of false if the blob was not found (i.e. it was expunged or the ID was invalid)
      Throws:
      IOException
    • expungeBlob

      public void expungeBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
      Specified by:
      expungeBlob in interface IBinaryStorageSvc
    • fetchBlob

      public byte[] fetchBlob(org.hl7.fhir.instance.model.api.IIdType theResourceId, String theBlobId)
      Description copied from interface: IBinaryStorageSvc
      Fetch the contents of the given blob
      Specified by:
      fetchBlob in interface IBinaryStorageSvc
      Parameters:
      theResourceId - The resource ID
      theBlobId - The blob ID
      Returns:
      The payload as a byte array
    • clear

      public void clear()