Class ResourceContent

java.lang.Object
org.fcrepo.storage.ocfl.ResourceContent
All Implemented Interfaces:
AutoCloseable

public class ResourceContent extends Object implements AutoCloseable
Encapsulates a resource's content and its headers.
Author:
pwinckles
  • Constructor Details

    • ResourceContent

      public ResourceContent(InputStream contentStream, ResourceHeaders headers)
      Creates a new instance
      Parameters:
      contentStream - the resource's content, may be null
      headers - the resource's headers
    • ResourceContent

      public ResourceContent(Optional<InputStream> contentStream, ResourceHeaders headers)
      Creates a new instance
      Parameters:
      contentStream - the resource's content
      headers - the resource's headers
  • Method Details

    • getContentStream

      public Optional<InputStream> getContentStream()
      Returns:
      the resource's content
    • getHeaders

      public ResourceHeaders getHeaders()
      Returns:
      the resource's headers
    • close

      public void close() throws IOException
      Closes the underlying resource content stream.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException - if the stream is not closed cleanly