- 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. TheCharSequenceimplementation is the path.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceResource.ResourceOpenerFor 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 charcharAt(int index)intlength()InputStreamopen()Opens resource for reading.CharSequencesubSequence(int start, int end)StringtoString()-
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:
lengthin interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
- Specified by:
subSequencein interfaceCharSequence
-
toString
public String toString()
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject- Returns:
- path passed to the constructor
-
-