org.specrunner.readers.core
Class ReaderFile

java.lang.Object
  extended by org.specrunner.readers.core.ReaderFile
All Implemented Interfaces:
Serializable, IReader, IResetable

public class ReaderFile
extends Object
implements IReader

Reader of content of a specified file.

Author:
Thiago Santos.
See Also:
Serialized Form

Field Summary
protected  IResolver resolver
          Relative URI resolver.
 
Constructor Summary
ReaderFile()
           
 
Method Summary
 IResolver getResolver()
          Resolver of relative links.
protected  ISource getSource(URI newHref)
          Get source from a URI.
 void initialize()
          Initialize something.
 boolean isReplacer()
          Says to replace content after reading.
 String read(IContext context, Object obj, Object[] args)
          Read the content of an object as String.
 void setResolver(IResolver resolver)
          Change the resolver.
protected  void updateHref(nu.xom.Element element, URI newHref)
          Update href link of included files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resolver

protected IResolver resolver
Relative URI resolver.

Constructor Detail

ReaderFile

public ReaderFile()
Method Detail

getResolver

public IResolver getResolver()
Resolver of relative links.

Returns:
The current resolver.

setResolver

public void setResolver(IResolver resolver)
Change the resolver.

Parameters:
resolver - A resolver.

initialize

public void initialize()
Description copied from interface: IResetable
Initialize something.

Specified by:
initialize in interface IResetable

read

public String read(IContext context,
                   Object obj,
                   Object[] args)
            throws ReaderException
Description copied from interface: IReader
Read the content of an object as String.

Specified by:
read in interface IReader
Parameters:
context - The test context.
obj - An object reader.
args - Arguments of reading.
Returns:
A text.
Throws:
ReaderException - On reading errors.

getSource

protected ISource getSource(URI newHref)
                     throws PluginException
Get source from a URI.

Parameters:
newHref - The URI.
Returns:
The corresponding source.
Throws:
PluginException - On reading errors.

updateHref

protected void updateHref(nu.xom.Element element,
                          URI newHref)
                   throws PluginException
Update href link of included files.

Parameters:
element - Href container.
newHref - The href source.
Throws:
PluginException - On calculation error.

isReplacer

public boolean isReplacer()
Description copied from interface: IReader
Says to replace content after reading.

Specified by:
isReplacer in interface IReader
Returns:
true, if replace is enabled, false, otherwise.


Copyright © 2015. All rights reserved.