info.textgrid.utils.linkrewriter
Class AbstractRewriter

java.lang.Object
  extended by info.textgrid.utils.linkrewriter.AbstractRewriter
All Implemented Interfaces:
ILinkRewriter
Direct Known Subclasses:
ConfigurableXMLRewriter, SimpleTextRewriter, XMLLinkRewriter

public abstract class AbstractRewriter
extends Object
implements ILinkRewriter

Abstract implementation of ILinkRewriter that can serve as a base class.

Author:
vitt

Constructor Summary
Modifier Constructor and Description
protected AbstractRewriter(ImportMapping mapping, boolean export)
           
 
Method Summary
Modifier and Type Method and Description
 ImportMapping getMapping()
          Returns the mapping object that describes the neccessary rewrite actions
 boolean isExport()
          If this is true, the rewriting operation is intended for an export situation, i.e.
abstract  void rewrite(InputStream input, OutputStream output)
          Copies contents from input to output, rewriting links according to the mapping and the export setting, in an implementation dependent manner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRewriter

protected AbstractRewriter(ImportMapping mapping,
                           boolean export)
Method Detail

getMapping

public ImportMapping getMapping()
Description copied from interface: ILinkRewriter
Returns the mapping object that describes the neccessary rewrite actions

Specified by:
getMapping in interface ILinkRewriter

isExport

public boolean isExport()
Description copied from interface: ILinkRewriter
If this is true, the rewriting operation is intended for an export situation, i.e. TextGrid URIs are converted to local URIs.

Specified by:
isExport in interface ILinkRewriter

rewrite

public abstract void rewrite(InputStream input,
                             OutputStream output)
                      throws IOException,
                             XMLStreamException
Description copied from interface: ILinkRewriter
Copies contents from input to output, rewriting links according to the mapping and the export setting, in an implementation dependent manner.

Specified by:
rewrite in interface ILinkRewriter
Parameters:
input - the stream from which the rewriter reads
output - the stream to which the rewriter writes the rewritten code
Throws:
IOException - if reading or writing fails
XMLStreamException - on fatal errors during XML processing.


Copyright © 2012 TextGrid. All Rights Reserved.