public class IndexingSink extends SinkWrapper
IndexEntry
objects for sections.JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, NUMBERING_DECIMAL, NUMBERING_LOWER_ALPHA, NUMBERING_LOWER_ROMAN, NUMBERING_UPPER_ALPHA, NUMBERING_UPPER_ROMAN, SECTION_LEVEL_1, SECTION_LEVEL_2, SECTION_LEVEL_3, SECTION_LEVEL_4, SECTION_LEVEL_5, SECTION_LEVEL_6
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STAR
Constructor and Description |
---|
IndexingSink(IndexEntry rootEntry)
Deprecated.
legacy constructor, use
IndexingSink(Sink) with SinkAdapter as argument and call getRootEntry() to retrieve the index tree afterwards. |
IndexingSink(Sink delegate) |
Modifier and Type | Method and Description |
---|---|
void |
anchor(String name,
SinkEventAttributes attributes)
Starts an element which defines an anchor.
|
void |
close()
Close the writer or the stream, if needed.
|
IndexEntry |
getRootEntry()
This should only be called once the sink is closed.
|
String |
getTitle()
Getter for the field
title . |
protected void |
onIndexEntry(IndexEntry entry)
Called at the beginning of each entry (once all metadata about it is collected).
|
IndexEntry |
peek()
peek.
|
void |
pop()
Removes the IndexEntry at the top of this stack.
|
void |
push(IndexEntry entry)
Pushes an IndexEntry onto the top of this stack.
|
void |
section_(int level)
Ends a section at the given level.
|
void |
section(int level,
SinkEventAttributes attributes)
Start a new section at the given level.
|
void |
sectionTitle_(int level)
Ends a section title at the given level.
|
void |
text(String text,
SinkEventAttributes attributes)
Adds a text.
|
void |
title_()
Ends the title element.
|
void |
title(SinkEventAttributes attributes)
Starts the title element.
|
address_, address, anchor_, article_, article, author_, author, blockquote_, blockquote, body_, body, bold_, bold, comment, content_, content, data_, data, date_, date, definedTerm_, definedTerm, definition_, definition, definitionList_, definitionList, definitionListItem_, definitionListItem, division_, division, figure_, figure, figureCaption_, figureCaption, figureGraphics, flush, footer_, footer, getWrappedSink, head_, head, header_, header, horizontalRule, inline_, inline, italic_, italic, lineBreak, lineBreakOpportunity, link_, link, list_, list, listItem_, listItem, monospaced_, monospaced, navigation_, navigation, nonBreakingSpace, numberedList_, numberedList, numberedListItem_, numberedListItem, pageBreak, paragraph_, paragraph, rawText, sectionTitle, setWrappedSink, sidebar_, sidebar, table_, table, tableCaption_, tableCaption, tableCell_, tableCell, tableHeaderCell_, tableHeaderCell, tableRow_, tableRow, tableRows_, tableRows, time_, time, unknown, verbatim_, verbatim
address, anchor, article, author, blockquote, body, content, data, date, definedTerm, definition, definitionList, definitionListItem, division, figure, figureCaption, figureGraphics, footer, head, header, horizontalRule, init, inline, lineBreak, lineBreakOpportunity, link, list, listItem, navigation, numberedList, numberedListItem, paragraph, section1_, section1, section2_, section2, section3_, section3, section4_, section4, section5_, section5, section6_, section6, sectionTitle_, sectionTitle, sectionTitle1_, sectionTitle1, sectionTitle2_, sectionTitle2, sectionTitle3_, sectionTitle3, sectionTitle4_, sectionTitle4, sectionTitle5_, sectionTitle5, sectionTitle6_, sectionTitle6, sidebar, table, tableCaption, tableCell, tableHeaderCell, tableRow, tableRows, text, time, title, unifyEOLs, verbatim
@Deprecated public IndexingSink(IndexEntry rootEntry)
IndexingSink(Sink)
with SinkAdapter
as argument and call getRootEntry()
to retrieve the index tree afterwards.public IndexingSink(Sink delegate)
public IndexEntry getRootEntry()
IllegalStateException
- in case the sink was not closed yetpublic void title(SinkEventAttributes attributes)
Sink
Supported attributes are the base attributes
.
title
in interface Sink
title
in class SinkWrapper
attributes
- A set of SinkEventAttributes
, may be null
.Sink.head(SinkEventAttributes)
public void title_()
Sink
title_
in interface Sink
title_
in class SinkWrapper
public void section(int level, SinkEventAttributes attributes)
Sink
Sections with higher level have to be entirely contained within sections of lower level.
Supported attributes are the base attributes
.
section
in interface Sink
section
in class SinkWrapper
level
- the section level (must be a value between 1 and 6).attributes
- A set of SinkEventAttributes
, may be null
.public void section_(int level)
Sink
public void sectionTitle_(int level)
Sink
sectionTitle_
in interface Sink
sectionTitle_
in class SinkWrapper
level
- the section title level (must be a value between 1 and 6).public void text(String text, SinkEventAttributes attributes)
Sink
The text
parameter should contain only real content, ie any
ignorable/collapsable whitespace/EOLs or other pretty-printing should
be removed/normalized by a parser.
If text
contains any variants of line terminators, they should
be normalized to the System EOL by an implementing Sink.
Supported attributes are the base attributes
plus
SEMANTICS
(values "emphasis", "strong",
"small", "line-through", "citation", "quote", "definition", "abbreviation",
"italic", "bold", "monospaced", "variable", "sample", "keyboard", "superscript",
"subscript", "annotation", "highlight", "ruby", "rubyBase", "rubyText",
"rubyTextContainer", "rubyParentheses", "bidirectionalIsolation",
"bidirectionalOverride", "phrase", "insert", "delete").
The following attributes are deprecated:
VALIGN
(values "sub", "sup"),DECORATION
(values "underline", "overline", "line-through"),STYLE
(values "italic", "bold", "monospaced").
text
in interface Sink
text
in class SinkWrapper
text
- The text to write.attributes
- A set of SinkEventAttributes
, may be null
.public void anchor(String name, SinkEventAttributes attributes)
Sink
The name
parameter has to be a valid SGML NAME token.
According to the
HTML 4.01 specification section 6.2 SGML basic types:
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
Supported attributes are the base attributes
.
If NAME
is specified in the SinkEventAttributes,
it will be overwritten by the name
parameter.
anchor
in interface Sink
anchor
in class SinkWrapper
name
- the name of the anchor. This has to be a valid SGML NAME token.attributes
- A set of SinkEventAttributes
, may be null
.protected void onIndexEntry(IndexEntry entry)
entry
- the newly collected entrypublic void push(IndexEntry entry)
entry
- to put.public void pop()
public IndexEntry peek()
peek.
public void close()
Sink
close
in interface AutoCloseable
close
in interface Sink
close
in class SinkWrapper
Copyright © 2005–2024 The Apache Software Foundation. All rights reserved.