|
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.editor.language.HistoryReadTextBuffer
The HistoryReadTextBuffer
is a decorator around a
ReadTextBuffer to aid in damage calculations by allowing a client
to examine a single prior version of the ReadTextBuffer if the
document event representating the change is available.
Note that certain methods have not been implemented, since they are not needed to work with a Lexer implementation.
Method Summary | |
static HistoryReadTextBuffer |
acquireReadTextBuffer(ReadTextBuffer buffer,
BasicDocumentEvent event)
Acquire a shared (reused) wrapper text buffer for use. |
char |
getChar(int offset)
Fetches the character from the given offset. |
char[] |
getChars(int offset,
int length)
Fetches a number of characters from the indicated offset in the buffer. |
int |
getLength()
Fetches the number of characters in this buffer. |
java.lang.String |
getString(int offset,
int length)
Fetches a number of characters from the indicated offset in the buffer and returns it as a String. |
void |
getText(int offset,
int length,
javax.swing.text.Segment segment)
Fetches the text contained within the given section of the TextBuffer The Segment object is
provided by the caller. |
void |
readLock()
Attempts to acquire a read lock on this text buffer for the purposes of reading the buffer - this is a blocking call. |
void |
readUnlock()
Releases a held read lock on this text buffer. |
static void |
releaseReadTextBuffer(HistoryReadTextBuffer buffer)
Release the wrapper text buffer so that it can be re-used. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static HistoryReadTextBuffer acquireReadTextBuffer(ReadTextBuffer buffer, BasicDocumentEvent event)
buffer
- the buffer we want to readevent
- the change that was applied to that buffer
public static void releaseReadTextBuffer(HistoryReadTextBuffer buffer)
buffer
- the wrapper to releasepublic int getLength()
getLength
in interface ReadTextBuffer
public char getChar(int offset) throws java.lang.IndexOutOfBoundsException
getChar
in interface ReadTextBuffer
offset
- the offset in the buffer to get the character from
java.lang.IndexOutOfBoundsException
- if offset is invalidpublic char[] getChars(int offset, int length) throws java.lang.IndexOutOfBoundsException
getChars
in interface ReadTextBuffer
offset
- the offset in the buffer to start fromlength
- number of characters to fetch
java.lang.IndexOutOfBoundsException
- if offset or length are invalidpublic java.lang.String getString(int offset, int length) throws java.lang.IndexOutOfBoundsException
getString
in interface ReadTextBuffer
offset
- the offset in the buffer to start fromlength
- number of characters to fetch
java.lang.IndexOutOfBoundsException
- if offset or length are invalidpublic void getText(int offset, int length, javax.swing.text.Segment segment) throws java.lang.IndexOutOfBoundsException
TextBuffer
The Segment
object is
provided by the caller. This is not currently implemented.
getText
in interface ReadTextBuffer
offset
- the offset into the buffer representing the desired
start of the data >= 0length
- the length of the desired data >= 0segment
- the caller's Segment object to return the data in
java.lang.IndexOutOfBoundsException
Document.getText(int, int)
public void readLock()
Note that for TextBuffer
objects, a call to
readLock() must be matched by a call to readUnlock() even if
nested within a writeLock()/writeUnlock(). This is to help
guarantee correctness.
readLock
in interface ReadTextBuffer
TextBuffer#getLineMap
,
TextBuffer#writeLock
public void readUnlock()
readUnlock
in interface ReadTextBuffer
|
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.