Class StringResource

java.lang.Object
scriptella.configuration.StringResource
All Implemented Interfaces:
Resource

public class StringResource extends Object implements Resource
Represents String as a resource.

This implementation is intended to represent small text blocks.

This resource is immutable and can be cached based on object identity.

Version:
1.0
Author:
Fyodor Kupolov
  • Constructor Details

    • StringResource

      public StringResource(String string)
      Creates a resource based on String content.
      Parameters:
      string - resource content.
    • StringResource

      public StringResource(String string, String description)
      Creates a resource based on String content.
      Parameters:
      string - resource content.
      description - resource description.
  • Method Details

    • open

      public Reader open() throws IOException
      Description copied from interface: Resource
      Opens a resource and returns a content reader.

      The returned reader implementation should be effective enough to allow usage without extra buffering, etc.

      Specified by:
      open in interface Resource
      Returns:
      resource content reader
      Throws:
      IOException - if I/O error occurs.
    • getString

      public String getString()
      Returns the string wrapped by this resource.
    • toString

      public String toString()
      Specified by:
      toString in interface Resource
      Overrides:
      toString in class Object
      Returns:
      location of content or meaningful description.