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
  • Constructor Details

    • Resource

      public Resource(String path, Resource origin)
      Creates a Resource object for the given path.
      Parameters:
      path - The path of this resource
  • Method Details

    • 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.
      Overrides:
      toString in class Object
      Returns:
      The content of the resource.
    • readText

      public static String readText(Reader reader) throws IOException
      Throws:
      IOException