Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


oracle.javatools.buffer
Interface LineMap


public interface LineMap

A LineMap is an interface for accessing the line structure information of a TextBuffer. This allows clients to determine the line that an offset is on, the starting and ending offset of a specific line, and the total number of lines in the TextBuffer.

Client Usage Notes:

Note that we do not follow the convention of the Swing text package, where documents have the implicit trailing '\n' character. The very last line of the TextBuffer does NOT have a trailing '\n' character.

See Also:
TextBuffer

Method Summary
 int getLineCount()
          Fetches the number of lines in this TextBuffer.
 int getLineEndOffset(int line)
          Given a specified line, returns the offset from the beginning of a TextBuffer that the line ends at.
 int getLineFromOffset(int offset)
          Given an offset from the beginning of the underlying TextBuffer, fetches the line number containing that offset using a Forward bias.
 int getLineStartOffset(int line)
          Given a specified line, returns the offset from the beginning of the TextBuffer for the start of the line.
 TextBuffer getTextBuffer()
          Fetches the underlying TextBuffer of this line map.

 

Method Detail

getTextBuffer

TextBuffer getTextBuffer()
Fetches the underlying TextBuffer of this line map.
Returns:
the text buffer

getLineCount

int getLineCount()
Fetches the number of lines in this TextBuffer. For example, a 5-line TextBuffer has lines 0 through 4.
Returns:
number of lines in TextBuffer

getLineFromOffset

int getLineFromOffset(int offset)
Given an offset from the beginning of the underlying TextBuffer, fetches the line number containing that offset using a Forward bias. This means if line A starts with offset B, and previous line A-1 ends with offset B, getLineFromOffset(B) will return line A.
Returns:
the line containing an offset

getLineStartOffset

int getLineStartOffset(int line)
Given a specified line, returns the offset from the beginning of the TextBuffer for the start of the line.
Parameters:
line - a line in the TextBuffer
Returns:
the starting offset of the specified line

getLineEndOffset

int getLineEndOffset(int line)
Given a specified line, returns the offset from the beginning of a TextBuffer that the line ends at.
Parameters:
line - a line in the TextBuffer
the - ending offset of the specified line

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.2.0)

E17493-03


Copyright © 1997, 2012, Oracle. All rights reserved.