- java.lang.Object
-
- uk.autores.handling.Resource
-
- All Implemented Interfaces:
CharSequence
public final class Resource extends Object implements CharSequence
A representation of the annotated resource. TheCharSequence
implementation is the path.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Resource.ResourceOpener
For retrieving resource contents.
-
Constructor Summary
Constructors Constructor Description Resource(Resource.ResourceOpener file, String path)
All arguments must be non-null.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
charAt(int index)
int
length()
InputStream
open()
Opens resource for reading.CharSequence
subSequence(int start, int end)
String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
-
-
-
Constructor Detail
-
Resource
public Resource(Resource.ResourceOpener file, String path)
All arguments must be non-null.- Parameters:
file
- resource bytespath
- as defined inResourceFiles.value()
-
-
Method Detail
-
open
public InputStream open() throws IOException
Opens resource for reading.- Returns:
- contents
- Throws:
IOException
- on I/O error- See Also:
FileObject.openInputStream()
-
length
public int length()
- Specified by:
length
in interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAt
in interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfaceCharSequence
-
toString
public String toString()
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
- Returns:
- path passed to the constructor
-
-