Package ro.sync.ecss.extensions.api
Interface Content
@API(type=NOT_EXTENDABLE,
src=PUBLIC)
public interface Content
Interface to describe a sequence of character content that can be edited.
-
Method Summary
Modifier and TypeMethodDescriptioncreatePosition
(int offset) Creates a position within the content.void
Retrieves a portion of the content into the specifiedSegment
.int
The length in characters of the content.getString
(int where, int len) Fetches a string of characters contained in the content sequence.void
insertChars
(int where, char[] ch, int start, int length) Inserts a sequence of characters into the content at a given offset.void
remove
(int where, int nitems) Removes some portion of the content sequence.
-
Method Details
-
createPosition
Creates a position within the content. The position offset is changed as the content is edited.- Parameters:
offset
- The offset in the content >= 0- Returns:
- A new
Position
. - Throws:
BadLocationException
- For an invalid offset
-
getLength
int getLength()The length in characters of the content.- Returns:
- The length >= 0
-
insertChars
Inserts a sequence of characters into the content at a given offset.- Parameters:
where
- Offset into the content to make the insertion >= 0ch
- The char buffer to insert from.start
- Start of useful data in the char buffer.length
- Length of useful data in the char buffer.- Throws:
BadLocationException
- thrown if the offset indicated by thewhere
argument is not contained in the boundaries of the content character sequence.
-
remove
Removes some portion of the content sequence.- Parameters:
where
- The offset into the sequence to make the removal >= 0.nitems
- The number of items in the sequence to be removed >= 0.- Throws:
BadLocationException
- Thrown if the area covered by thewhere
andnitems
parameters is not contained in the content character sequence.
-
getString
Fetches a string of characters contained in the content sequence.- Parameters:
where
- Offset into the sequence to fetch >= 0.len
- Number of characters to copy >= 0.- Returns:
- The extracted String.
- Throws:
BadLocationException
- Thrown if the area covered by the arguments is not contained in the content character sequence.
-
getChars
Retrieves a portion of the content into the specifiedSegment
. If the desired content spans the gap, we copy the content. If the desired content does not span the gap, the actual store is returned to avoid the copy since it is contiguous.- Parameters:
where
- The starting position >= 0, where + len <= length()len
- The number of characters to be retrieved >= 0chars
- TheSegment
object to return the characters into.- Throws:
BadLocationException
- If the specified position or length are invalid.
-