scriptella.configuration
Class StringResource

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

public class StringResource
extends java.lang.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 Summary
StringResource(java.lang.String string)
          Creates a resource based on String content.
StringResource(java.lang.String string, java.lang.String description)
          Creates a resource based on String content.
 
Method Summary
 java.lang.String getString()
          Returns the string wrapped by this resource.
 java.io.Reader open()
          Opens a resource and returns a content reader.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringResource

public StringResource(java.lang.String string)
Creates a resource based on String content.

Parameters:
string - resource content.

StringResource

public StringResource(java.lang.String string,
                      java.lang.String description)
Creates a resource based on String content.

Parameters:
string - resource content.
description - resource description.
Method Detail

open

public java.io.Reader open()
                    throws java.io.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:
java.io.IOException - if I/O error occurs.

getString

public java.lang.String getString()
Returns the string wrapped by this resource.


toString

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


Copyright © Copyright 2006-2009 The Scriptella Project Team.