Package org.fcrepo.storage.ocfl
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 Summary
Constructors Constructor Description ResourceContent(InputStream contentStream, ResourceHeaders headers)Creates a new instanceResourceContent(Optional<InputStream> contentStream, ResourceHeaders headers)Creates a new instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying resource content stream.Optional<InputStream>getContentStream()ResourceHeadersgetHeaders()
-
-
-
Constructor Detail
-
ResourceContent
public ResourceContent(InputStream contentStream, ResourceHeaders headers)
Creates a new instance- Parameters:
contentStream- the resource's content, may be nullheaders- the resource's headers
-
ResourceContent
public ResourceContent(Optional<InputStream> contentStream, ResourceHeaders headers)
Creates a new instance- Parameters:
contentStream- the resource's contentheaders- the resource's headers
-
-
Method Detail
-
getContentStream
public Optional<InputStream> getContentStream()
- Returns:
- the resource's content
-
getHeaders
public ResourceHeaders getHeaders()
- Returns:
- the resource's headers
-
close
public void close() throws IOExceptionCloses the underlying resource content stream.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if the stream is not closed cleanly
-
-