info.textgrid.utils.linkrewriter
Class SimpleTextRewriter
java.lang.Object
info.textgrid.utils.linkrewriter.AbstractRewriter
info.textgrid.utils.linkrewriter.SimpleTextRewriter
- All Implemented Interfaces:
- ILinkRewriter
public class SimpleTextRewriter
extends AbstractRewriter
implements ILinkRewriter
A simple rewriter for plain-text files. Reads a file line by line and
performs simple text replacement from a to b.
- Author:
- vitt
- See Also:
RewriteMethod.TEXT
Constructor Summary
SimpleTextRewriter(ImportMapping mapping,
boolean export)
A rewriter that can rewrite simple text files by replacing everything at
word boundaries. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleTextRewriter
public SimpleTextRewriter(ImportMapping mapping,
boolean export)
- A rewriter that can rewrite simple text files by replacing everything at
word boundaries.
- Parameters:
mapping
- The mapping between TextGrid URIs and other (local) files.export
- If true, we're exporting from TextGrid (i.e. we need to
replace TextGrid URIs with local URIs).
rewrite
public void rewrite(InputStream input,
OutputStream output)
throws IOException
- Copies contents from input to output, rewriting
links according to the mapping and the
export setting, in an implementation dependent
manner.
The
SimpleTextRewriter
implementation rewrites links by simple
text replacements.
- Specified by:
rewrite
in interface ILinkRewriter
- Specified by:
rewrite
in class AbstractRewriter
- Parameters:
input
- the stream from which the rewriter readsoutput
- the stream to which the rewriter writes the rewritten code
- Throws:
IOException
- if reading or writing fails
Copyright © 2012 TextGrid. All Rights Reserved.