public final class TransformerWriter
extends java.io.Writer
Modifier and Type | Field and Description |
---|---|
private boolean |
binaryUnsuspect |
private CharBuffer |
buffer |
static char |
dash |
static char |
doublequote |
static char |
excl |
private boolean |
inComment |
private boolean |
inDoubleQuote |
private boolean |
inSingleQuote |
static char |
lb |
private java.io.OutputStreamWriter |
out |
private java.io.OutputStream |
outStream |
private boolean |
passbyIfBinarySuspect |
static char |
rb |
private Scraper |
scraper |
static char |
singlequote |
private java.util.Stack<ContentScraper.Tag> |
tagStack |
private Transformer |
transformer |
Constructor and Description |
---|
TransformerWriter(java.io.OutputStream outStream,
java.nio.charset.Charset charSet,
Scraper scraper,
Transformer transformer,
boolean passbyIfBinarySuspect) |
TransformerWriter(java.io.OutputStream outStream,
java.nio.charset.Charset charSet,
Scraper scraper,
Transformer transformer,
boolean passbyIfBinarySuspect,
int initialBufferSize) |
Modifier and Type | Method and Description |
---|---|
private static boolean |
binaryHint(char c) |
boolean |
binarySuspect() |
void |
close() |
private char[] |
filterFinalize(char quotechar) |
private char[] |
filterTag(char[] content) |
private char[] |
filterTag(char[] content,
char quotechar,
java.lang.String tagname,
boolean opening) |
private char[] |
filterTagCloseing(char quotechar) |
private char[] |
filterTagOpening(java.lang.String tagname,
char[] content,
char quotechar) |
void |
flush() |
static char[] |
genOpts(java.util.Properties prop,
char quotechar) |
static char[] |
genTag0(java.lang.String tagname,
java.util.Properties tagopts,
char quotechar) |
static char[] |
genTag0raw(java.lang.String tagname,
boolean opening,
char[] tagopts) |
static char[] |
genTag1(java.lang.String tagname,
java.util.Properties tagopts,
char[] text,
char quotechar) |
static char[] |
genTag1raw(java.lang.String tagname,
char[] tagopts,
char[] text) |
private static int |
tagEnd(char[] tag,
int start) |
private char[] |
tokenProcessor(char[] in,
char quotechar)
the token processor distinguishes three different types of input: opening tag, closing tag, text content
|
void |
write(char[] b) |
void |
write(char[] b,
int off,
int len) |
void |
write(int c)
this is the tokenizer of the parser: it splits the input into pieces which are
- quoted text parts
- commented text parts
- tags (opening and closing)
- text content between all these parts
The tokens are then parsed with the filterSentence method
|
public static final char lb
public static final char rb
public static final char dash
public static final char excl
public static final char singlequote
public static final char doublequote
private final java.io.OutputStream outStream
private java.io.OutputStreamWriter out
private CharBuffer buffer
private java.util.Stack<ContentScraper.Tag> tagStack
private final Scraper scraper
private final Transformer transformer
private boolean inSingleQuote
private boolean inDoubleQuote
private boolean inComment
private boolean binaryUnsuspect
private final boolean passbyIfBinarySuspect
public TransformerWriter(java.io.OutputStream outStream, java.nio.charset.Charset charSet, Scraper scraper, Transformer transformer, boolean passbyIfBinarySuspect)
public TransformerWriter(java.io.OutputStream outStream, java.nio.charset.Charset charSet, Scraper scraper, Transformer transformer, boolean passbyIfBinarySuspect, int initialBufferSize)
public static char[] genTag0raw(java.lang.String tagname, boolean opening, char[] tagopts)
public static char[] genTag1raw(java.lang.String tagname, char[] tagopts, char[] text)
public static char[] genTag0(java.lang.String tagname, java.util.Properties tagopts, char quotechar)
public static char[] genTag1(java.lang.String tagname, java.util.Properties tagopts, char[] text, char quotechar)
public static char[] genOpts(java.util.Properties prop, char quotechar)
private char[] tokenProcessor(char[] in, char quotechar)
in
- - the token to be processedquotechar
- private char[] filterTag(char[] content)
content
- private char[] filterTag(char[] content, char quotechar, java.lang.String tagname, boolean opening)
private char[] filterTagOpening(java.lang.String tagname, char[] content, char quotechar)
private char[] filterTagCloseing(char quotechar)
private char[] filterFinalize(char quotechar)
private static int tagEnd(char[] tag, int start)
public void write(int c) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(char[] b) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void write(char[] b, int off, int len) throws java.io.IOException
write
in class java.io.Writer
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
private static boolean binaryHint(char c)
public boolean binarySuspect()