Class LazyInputStreamResource
java.lang.Object
org.springframework.core.io.AbstractResource
com.broadleafcommerce.dataimport.service.support.LazyInputStreamResource
- All Implemented Interfaces:
org.springframework.core.io.InputStreamSource
,org.springframework.core.io.Resource
public class LazyInputStreamResource
extends org.springframework.core.io.AbstractResource
An alternative to
InputStreamResource
that only creates the InputStream
when
getInputStream()
is invoked.
This is based on the suggestion outlined in this issue.
- Author:
- Samarth Dhruva (samarthd)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
An alternative toSupplier
that allows throwing anIOException
. -
Constructor Summary
ConstructorsConstructorDescriptionLazyInputStreamResource
(LazyInputStreamResource.IOThrowingSupplier<InputStream> inputStreamSupplier) -
Method Summary
Methods inherited from class org.springframework.core.io.AbstractResource
contentLength, createRelative, exists, getFile, getFileForLastModifiedCheck, getFilename, getURI, getURL, isFile, isOpen, isReadable, lastModified, readableChannel, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.core.io.Resource
getContentAsByteArray, getContentAsString
-
Constructor Details
-
LazyInputStreamResource
public LazyInputStreamResource(LazyInputStreamResource.IOThrowingSupplier<InputStream> inputStreamSupplier)
-
-
Method Details
-
getDescription
-
getInputStream
- Throws:
IOException
-
equals
- Overrides:
equals
in classorg.springframework.core.io.AbstractResource
-
canEqual
-
hashCode
public int hashCode()- Overrides:
hashCode
in classorg.springframework.core.io.AbstractResource
-