Package com.bc.ceres.resource
Class Resource
- java.lang.Object
-
- com.bc.ceres.resource.Resource
-
- Direct Known Subclasses:
FileResource
,ReaderResource
,StringResource
public abstract class Resource extends Object
This class encapsulates the content of a resource. This can be either XML or Java properties.- Since:
- Ceres 0.13.2
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
getContent()
Returns the exact copy of the content of the resource.SortedMap<String,String>
getMap()
Returns an alphabetically sorted map, only if the content of the resource was a Java properties file.Resource
getOrigin()
String
getPath()
Gets the path of the resource on the underlying file system.boolean
isXml()
True, if the content of the resource is of XML format.protected abstract String
read()
static String
readText(Reader reader)
String
toString()
Returns the exact copy of the content of the resource.
-
-
-
Method Detail
-
read
protected abstract String read()
-
getPath
public String getPath()
Gets the path of the resource on the underlying file system.- Returns:
- The path of the resource
-
getOrigin
public Resource getOrigin()
-
isXml
public boolean isXml()
True, if the content of the resource is of XML format.- Returns:
- True, if content is XML.
-
getContent
public String getContent()
Returns the exact copy of the content of the resource.- Returns:
- The content of the resource.
-
getMap
public SortedMap<String,String> getMap()
Returns an alphabetically sorted map, only if the content of the resource was a Java properties file.- Returns:
- Properties as map.
-
toString
public String toString()
Returns the exact copy of the content of the resource.
-
readText
public static String readText(Reader reader) throws IOException
- Throws:
IOException
-
-