java.lang.Object
com.aquima.interactions.foundation.io.resource.ResourceDelegate
com.aquima.interactions.foundation.io.resource.TextResource
All Implemented Interfaces:
IResource

public class TextResource extends ResourceDelegate
This resource implementation can be used to read/write textual data to/from a resource with a specific character set. (See AQU-4396)
Since:
7.2
Author:
V. Jansen, Jon van Leuven
  • Constructor Details

    • TextResource

      public TextResource(IResource resource, String characterSet)
      Constructor to create a text resource with a delegate resource an a character set.
      Parameters:
      resource - The delegate resource, may not be null.
      characterSet - The character set, may not be null.
  • Method Details

    • asReader

      public Reader asReader()
      This method returns a reader with the character set of this text resource.
      Specified by:
      asReader in interface IResource
      Overrides:
      asReader in class ResourceDelegate
      Returns:
      reader The reader.
      Throws:
      ResourceException - This exception is thrown when the resource could not be read.
    • asWriter

      public Writer asWriter(boolean append)
      This method returns a writer with the character set of this text resource.
      Specified by:
      asWriter in interface IResource
      Overrides:
      asWriter in class ResourceDelegate
      Parameters:
      append - Boolean indicating if the data added to the writer should be appended to the resource.
      Returns:
      writer The writer.
      Throws:
      ResourceException - This exception is thrown when no writer is available for the resource (for instance due to the resource being read-only).