com.espertech.esperio
Class AdapterInputSource

java.lang.Object
  extended by com.espertech.esperio.AdapterInputSource

public class AdapterInputSource
extends java.lang.Object

An input source for adapters.


Constructor Summary
AdapterInputSource(java.io.File file)
          Ctor.
AdapterInputSource(java.io.InputStream inputStream)
          Ctor.
AdapterInputSource(java.io.Reader reader)
          Ctor.
AdapterInputSource(java.lang.String classpathResource)
          Ctor.
AdapterInputSource(java.net.URL url)
          Ctor.
 
Method Summary
 void close()
           
 java.io.Reader getAsReader()
          Return the reader if it was set, null otherwise.
 java.io.InputStream getAsStream()
          Get the resource as an input stream.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdapterInputSource

public AdapterInputSource(java.lang.String classpathResource)
Ctor.

Parameters:
classpathResource - - the name of the resource on the classpath to use as the source for an adapter

AdapterInputSource

public AdapterInputSource(java.net.URL url)
Ctor.

Parameters:
url - - the URL for the resource to use as source for an adapter

AdapterInputSource

public AdapterInputSource(java.io.File file)
Ctor.

Parameters:
file - - the file to use as a source

AdapterInputSource

public AdapterInputSource(java.io.InputStream inputStream)
Ctor.

Parameters:
inputStream - - the stream to use as a source

AdapterInputSource

public AdapterInputSource(java.io.Reader reader)
Ctor.

Parameters:
reader - is any reader for reading a file or string
Method Detail

getAsStream

public java.io.InputStream 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

public java.io.Reader 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()

© 2006-2016 EsperTech Inc.
All rights reserved.
Visit us at espertech.com