public abstract class AbstractGuardedSectionsProvider extends Object implements GuardedSectionsProvider
GuardedSectionsProvider
implementations. Subclasses have to implement just AbstractGuardedSectionsProvider.readSections(char[])
and AbstractGuardedSectionsProvider.writeSections(java.util.List<org.netbeans.api.editor.guards.GuardedSection>, char[])
methods.Modifier and Type | Class and Description |
---|---|
class |
AbstractGuardedSectionsProvider.Result |
Modifier | Constructor and Description |
---|---|
protected |
AbstractGuardedSectionsProvider(GuardedEditorSupport editor)
Creates an AbstractGuardedSectionsProvider.
|
protected |
AbstractGuardedSectionsProvider(GuardedEditorSupport editor,
boolean useReadersWritersOnSet)
Creates an AbstractGuardedSectionsProvider.
|
Modifier and Type | Method and Description |
---|---|
Reader |
createGuardedReader(InputStream stream,
Charset charset)
Creates a reader able to read persisted sections.
|
Writer |
createGuardedWriter(OutputStream stream,
Charset charset)
Creates a writer able to write persisted sections.
|
InteriorSection |
createInteriorSection(String name,
int headerBegin,
int headerEnd,
int footerBegin,
int footerEnd)
Creates an interior section object to represent section read by
the
readSections . |
SimpleSection |
createSimpleSection(String name,
int begin,
int end)
Creates a simple section object to represent section read by
the
readSections . |
abstract AbstractGuardedSectionsProvider.Result |
readSections(char[] content)
This should be implemented to extract guarded sections out of the passed
content.
|
abstract char[] |
writeSections(List<GuardedSection> sections,
char[] content)
This should be implemented to persist a list of guarded sections inside
the passed content.
|
protected AbstractGuardedSectionsProvider(GuardedEditorSupport editor)
editor
- an editor abstractionprotected AbstractGuardedSectionsProvider(GuardedEditorSupport editor, boolean useReadersWritersOnSet)
editor
- an editor abstractionuseReadersWritersOnSet
- if readers and writers should be used when the content of the guarded section's text is setpublic final Reader createGuardedReader(InputStream stream, Charset charset)
GuardedSectionsProvider
createGuardedReader
in interface GuardedSectionsProvider
stream
- stream containing persisted sectionscharset
- charset to decode read bytes, null
implies
the system default charset.public Writer createGuardedWriter(OutputStream stream, Charset charset)
GuardedSectionsProvider
createGuardedWriter
in interface GuardedSectionsProvider
stream
- stream where the output should be writtencharset
- charset used by the writerpublic abstract char[] writeSections(List<GuardedSection> sections, char[] content)
sections
- guarded sections to persistcontent
- contentpublic abstract AbstractGuardedSectionsProvider.Result readSections(char[] content)
content
- content including guarded sectionspublic final SimpleSection createSimpleSection(String name, int begin, int end) throws BadLocationException
readSections
.name
- the section namebegin
- the start offsetend
- the end offsetBadLocationException
- if the given position does not
represent a valid location in the associated documentpublic final InteriorSection createInteriorSection(String name, int headerBegin, int headerEnd, int footerBegin, int footerEnd) throws BadLocationException
readSections
.name
- the section nameheaderBegin
- begin the start offset of the first guarded partheaderEnd
- end the end offset of the first guarded partfooterBegin
- begin the start offset of the second guarded partfooterEnd
- end the end offset of the second guarded partBadLocationException
- if the given position does not
represent a valid location in the associated document