|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.buffer.TextBufferFactory
The TextBufferFactory
is a static factory class for
creating TextBuffer
instances for use. This is done
in order to separate our published API from our implementation
details from TextBuffer
clients.
Method Summary | |
static TextBuffer |
createArrayTextBuffer()
Creates a new empty instance of the TextBuffer using
a flat array implementation. |
static java.text.CharacterIterator |
createCharacterIterator(ReadTextBuffer textBuffer)
Constructs a new CharacterIterator wrapper for the
given text buffer instance so that the buffer can be used with
a BreakIterator in the java.text package. |
static TextBuffer |
createGapTextBuffer()
Creates a new empty instance of the TextBuffer using
a gap buffer implementation. |
static java.io.Reader |
createReader(ReadTextBuffer textBuffer)
Constructs a new Reader wrapper for the given
text buffer instance so that the buffer can be read using the
Reader API. |
static TextBuffer |
createReadOnlyTextBufferWrapper(TextBuffer textBuffer)
Creates a read-only wrapper that implements the TextBuffer interface around the specified
interface. |
static ReadTextBuffer |
createReadTextBuffer(char[] dataSource)
Creates a ReadTextBuffer wrapper implementation for
the given String data source so that it can be
used with other classes that accept a ReadTextBuffer
such as the parser package. |
static ReadTextBuffer |
createReadTextBuffer(java.lang.String dataSource)
Creates a ReadTextBuffer wrapper implementation for
the given String data source so that it can be
used with other classes that accept a ReadTextBuffer
such as the parser package. |
static TextBuffer |
createTextBuffer()
Creates a new empty instance of the TextBuffer using
a default implementation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static TextBuffer createTextBuffer()
TextBuffer
using
a default implementation. The current default is to use a gap
implementation.
TextBuffer
instancecreateGapTextBuffer()
public static TextBuffer createArrayTextBuffer()
TextBuffer
using
a flat array implementation. This implementation uses a flat
array with extra space at the end to store the data. This performs
well when the buffer contains nearly static data as it requires
less overhead when accessing (reading) the buffer as compared
to the gap implementation.
TextBuffer
instancepublic static TextBuffer createGapTextBuffer()
TextBuffer
using
a gap buffer implementation. This implementation uses an array
containing a gap to store the data. This performs well for
typical edits which are frequently clustered together.
TextBuffer
instancepublic static TextBuffer createReadOnlyTextBufferWrapper(TextBuffer textBuffer)
TextBuffer
interface around the specified
interface. This wrapper can be provided to other clients (like
an editor) to allow it to read the contents of the text buffer,
but not modify it.
textBuffer
- the source text buffer to wrap
public static ReadTextBuffer createReadTextBuffer(java.lang.String dataSource)
ReadTextBuffer
wrapper implementation for
the given String
data source so that it can be
used with other classes that accept a ReadTextBuffer
such as the parser package.
dataSource
- the String dataSource
ReadTextBuffer
wrapper instancepublic static ReadTextBuffer createReadTextBuffer(char[] dataSource)
ReadTextBuffer
wrapper implementation for
the given String
data source so that it can be
used with other classes that accept a ReadTextBuffer
such as the parser package.
dataSource
- the String dataSource
ReadTextBuffer
wrapper instancepublic static java.text.CharacterIterator createCharacterIterator(ReadTextBuffer textBuffer)
CharacterIterator
wrapper for the
given text buffer instance so that the buffer can be used with
a BreakIterator
in the java.text package. It is
the responsibility of the caller to guarantee that the contents
of the text buffer do not change for the duration that this
CharacterIterator
is used.
textBuffer
- the text buffer to provide a CharacterIterator
wrapper on top of
public static java.io.Reader createReader(ReadTextBuffer textBuffer)
Reader
wrapper for the given
text buffer instance so that the buffer can be read using the
Reader
API. Note that as long as the Reader
wrapper is open, the text buffer will be held with a read lock.
Clients should make sure to close()
the
Reader
when it is no longer needed.
textBuffer
- the text buffer to provide a Reader wrapper on top of
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.