|
||||||||||
| 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(File file)
|
|
Input(String description,
InputStream is)
|
|
Input(URL url)
|
|
| Method Summary | |
|---|---|
Input |
copy()
Get a fresh version of this Input - i.e. |
String |
getContentAsString()
|
String |
getDescription()
|
static Input |
getInput(File file)
factory method for creating an Input. |
static Input |
getInput(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(String description,
InputStream in)
factory method for creating an Input. |
static Input |
getInput(URL url)
factory method for creating an Input. |
InputStream |
getInputStream()
|
Reader |
getReader()
Creates a Reader for this Input |
Reader |
getReader(String encoding)
Creates a Reader for this Input with given encoding. |
Input |
getRelativeInput(String name)
Tries to resolve a Resource relative to this Input. |
Input |
resolveInput(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. |
File |
toFile()
returns a File for this Input if possible. |
String |
toString()
|
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(URL url)
throws IOException
IOException
public Input(File file)
throws FileNotFoundException
FileNotFoundException
public Input(String description,
InputStream is)
| Method Detail |
|---|
public InputStream getInputStream()
public Reader getReader()
public Reader getReader(String encoding)
throws UnsupportedEncodingException
encoding - the encoding to use for the created Reader
UnsupportedEncodingException
public Input getRelativeInput(String name)
throws IOException
name - the relative name for the resource.
IOException - if no such relative resource was found.
public Input resolveInput(String name)
throws IOException
name - the name of the resource.
IOException - if sth. goes wrong.
public File toFile()
throws UnsupportedOperationException
File for this Input if possible.
UnsupportedOperationException - if this Input is not from a file.
public URL toURL()
throws MalformedURLException
URL for this Input if possible.
MalformedURLException - if this Input can't be converted to a URL.public String getDescription()
public String toString()
toString in class Object
public static Input getInput(URL url)
throws IOException
Input.
url - the URL to create the Input for.
IOException
public static Input getInput(File file)
throws IOException
Input.
file - the file to create the Input for.
IOException
public static Input getInput(String description,
InputStream in)
throws IOException
Input.
in - the InputStream to create the Input for.description - a String describing the type of input.
IOException
public static Input getInput(String resourceName)
throws IOException
resourceName - the name of the resource to look for
IOException
public Input copy()
throws IOException
IOException
public String getContentAsString()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||