Package com.espertech.esperio.csv
Class AdapterInputSource
java.lang.Object
com.espertech.esperio.csv.AdapterInputSource
An input source for adapters.
-
Constructor Summary
ConstructorDescriptionAdapterInputSource
(File file) Ctor.AdapterInputSource
(InputStream inputStream) Ctor.AdapterInputSource
(Reader reader) Ctor.AdapterInputSource
(String classpathResource) Ctor.AdapterInputSource
(URL url) Ctor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Return the reader if it was set, null otherwise.Get the resource as an input stream.boolean
Return true if calling getStream() will return a new InputStream created from the resource, which, assuming that the resource hasn't been changed, will have the same information as all the previous InputStreams returned by getStream() before they were manipulated; return false if the call will return the same instance of InputStream that has already been obtained.
-
Constructor Details
-
AdapterInputSource
Ctor.- Parameters:
classpathResource
- - the name of the resource on the classpath to use as the source for an adapter
-
AdapterInputSource
Ctor.- Parameters:
url
- - the URL for the resource to use as source for an adapter
-
AdapterInputSource
Ctor.- Parameters:
file
- - the file to use as a source
-
AdapterInputSource
Ctor.- Parameters:
inputStream
- - the stream to use as a source
-
AdapterInputSource
Ctor.- Parameters:
reader
- is any reader for reading a file or string
-
-
Method Details
-
getAsStream
Get the resource as an input stream. If this resource was specified as an InputStream, return that InputStream, otherwise, create and return a new InputStream from the resource. If the source cannot be converted to a stream, return null.- Returns:
- a stream from the resource
-
getAsReader
Return the reader if it was set, null otherwise.- Returns:
- the Reader
-
isResettable
public boolean isResettable()Return true if calling getStream() will return a new InputStream created from the resource, which, assuming that the resource hasn't been changed, will have the same information as all the previous InputStreams returned by getStream() before they were manipulated; return false if the call will return the same instance of InputStream that has already been obtained.- Returns:
- true if each call to getStream() will create a new InputStream from the resource, false if each call will get the same instance of the InputStream
-
close
public void close()
-