java.lang.Object | |
↳ | javax.swing.text.StringContent |
An implementation of the AbstractDocument.Content interface that is a brute force implementation that is useful for relatively small documents and/or debugging. It manages the character content as a simple character array. It is also quite inefficient.
It is generally recommended that the gap buffer or piece table implementations be used instead. This buffer does not scale up to large sizes.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see XMLEncoder
.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new StringContent object.
| |||||||||||
Creates a new StringContent object, with the initial
size specified.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a position within the content that will
track change as the content is mutated.
| |||||||||||
Retrieves a portion of the content.
| |||||||||||
Retrieves a portion of the content.
| |||||||||||
Inserts a string into the content.
| |||||||||||
Returns the length of the content.
| |||||||||||
Removes part of the content.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a Vector containing instances of UndoPosRef for the
Positions in the range
offset to offset + length . | |||||||||||
Resets the location for all the UndoPosRef instances
in
positions . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Creates a new StringContent object. Initial size defaults to 10.
Creates a new StringContent object, with the initial size specified. If the length is < 1, a size of 1 is used.
initialLength | the initial size |
---|
Creates a position within the content that will track change as the content is mutated.
offset | the offset to create a position for >= 0 |
---|
BadLocationException | if the specified position is invalid |
---|
Retrieves a portion of the content. where + len must be <= length()
where | the starting position >= 0 |
---|---|
len | the number of characters to retrieve >= 0 |
chars | the Segment object to return the characters in |
BadLocationException | if the specified position is invalid |
---|
Retrieves a portion of the content. where + len must be <= length().
where | the starting position >= 0 |
---|---|
len | the length to retrieve >= 0 |
BadLocationException | if the specified position is invalid |
---|
Inserts a string into the content.
where | the starting position >= 0 && < length() |
---|---|
str | the non-null string to insert |
BadLocationException | if the specified position is invalid |
---|
Removes part of the content. where + nitems must be < length().
where | the starting position >= 0 |
---|---|
nitems | the number of characters to remove >= 0 |
BadLocationException | if the specified position is invalid |
---|
Returns a Vector containing instances of UndoPosRef for the
Positions in the range
offset
to offset
+ length
.
If v
is not null the matching Positions are placed in
there. The vector with the resulting Positions are returned.
This is meant for internal usage, and is generally not of interest to subclasses.
v | the Vector to use, with a new one created on null |
---|---|
offset | the starting offset >= 0 |
length | the length >= 0 |
Resets the location for all the UndoPosRef instances
in positions
.
This is meant for internal usage, and is generally not of interest to subclasses.
positions | the positions of the instances |
---|