|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jreality.util.Input
public final class Input
Abstraction of an input source, whether given as a file on the local file system,
a URL, or as a Java resource.
Technically an instance covers an InputStream
.
Constructor Summary | |
---|---|
Input(java.io.File file)
|
|
Input(java.lang.String description,
java.io.InputStream is)
|
|
Input(java.net.URL url)
|
Method Summary | |
---|---|
Input |
copy()
Get a fresh version of this Input - i.e. |
java.lang.String |
getContentAsString()
|
java.lang.String |
getDescription()
|
static Input |
getInput(java.io.File file)
factory method for creating an Input . |
static Input |
getInput(java.lang.String resourceName)
searches for the given resource name as follows: if resourceName contains :// we try to load it as a URL if resourceName is an absolute filename the corresponding Input is created resourceName is searched in the classpath resourceName is searched relative to System.getProperty(SystemProperties.JREALITY_DATA) resourceName is searched relative to the current dir |
static Input |
getInput(java.lang.String description,
java.io.InputStream in)
factory method for creating an Input . |
static Input |
getInput(java.net.URL url)
factory method for creating an Input . |
java.io.InputStream |
getInputStream()
|
java.io.Reader |
getReader()
Creates a Reader for this Input |
java.io.Reader |
getReader(java.lang.String encoding)
Creates a Reader for this Input with given encoding. |
Input |
getRelativeInput(java.lang.String name)
Tries to resolve a Resource relative to this Input. |
Input |
resolveInput(java.lang.String name)
Tries to create an Input for the given name as follows: if there is a System resource with the given name, this is returned. |
java.io.File |
toFile()
returns a File for this Input if possible. |
java.lang.String |
toString()
|
java.net.URL |
toURL()
returns a URL for this Input if possible. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Input(java.net.URL url) throws java.io.IOException
java.io.IOException
public Input(java.io.File file) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public Input(java.lang.String description, java.io.InputStream is)
Method Detail |
---|
public java.io.InputStream getInputStream()
public java.io.Reader getReader()
public java.io.Reader getReader(java.lang.String encoding) throws java.io.UnsupportedEncodingException
encoding
- the encoding to use for the created Reader
java.io.UnsupportedEncodingException
public Input getRelativeInput(java.lang.String name) throws java.io.IOException
name
- the relative name for the resource.
java.io.IOException
- if no such relative resource was found.public Input resolveInput(java.lang.String name) throws java.io.IOException
name
- the name of the resource.
java.io.IOException
- if sth. goes wrong.public java.io.File toFile() throws java.lang.UnsupportedOperationException
File
for this Input if possible.
java.lang.UnsupportedOperationException
- if this Input is not from a file.public java.net.URL toURL() throws java.net.MalformedURLException
URL
for this Input if possible.
java.net.MalformedURLException
- if this Input can't be converted to a URL.public java.lang.String getDescription()
public java.lang.String toString()
toString
in class java.lang.Object
public static Input getInput(java.net.URL url) throws java.io.IOException
Input
.
url
- the URL to create the Input for.
java.io.IOException
public static Input getInput(java.io.File file) throws java.io.IOException
Input
.
file
- the file to create the Input for.
java.io.IOException
public static Input getInput(java.lang.String description, java.io.InputStream in) throws java.io.IOException
Input
.
in
- the InputStream to create the Input for.description
- a String describing the type of input.
java.io.IOException
public static Input getInput(java.lang.String resourceName) throws java.io.IOException
resourceName
- the name of the resource to look for
java.io.IOException
public Input copy() throws java.io.IOException
java.io.IOException
public java.lang.String getContentAsString() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |