gnu.lists
Class CharBuffer
java.lang.Object
gnu.lists.AbstractSequence
gnu.lists.GapVector
gnu.lists.StableVector
gnu.lists.CharBuffer
- All Implemented Interfaces:
- CharSeq, Consumable, Sequence, java.lang.CharSequence, java.lang.Iterable, java.util.Collection, java.util.List
- Direct Known Subclasses:
- BufferContent
public class CharBuffer
- extends StableVector
- implements CharSeq
Editable character sequence using a a buffer-gap implementstion and
self-adjusting position.
Can implement (the text part of) an Emacs buffer, or a
javax.swing.text.AbstractDocument.Content
Fields inherited from interface gnu.lists.Sequence |
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, EOF_VALUE, eofValue, FLOAT_VALUE, GROUP_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE |
Method Summary |
char |
charAt(int index)
|
void |
consume(int start,
int count,
Consumer dest)
|
void |
delete(int where,
int count)
|
void |
fill(char value)
Set all the elements to a given character. |
void |
fill(int fromIndex,
int toIndex,
char value)
|
char[] |
getArray()
|
void |
getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
Copy characters into a destination buffer. |
void |
insert(int where,
java.lang.String str,
boolean beforeMarkers)
|
int |
length()
Get length of string, in characters. |
void |
setCharAt(int index,
char value)
|
java.lang.CharSequence |
subSequence(int start,
int end)
|
java.lang.String |
toString()
|
void |
writeTo(java.lang.Appendable dest)
|
void |
writeTo(int start,
int count,
java.lang.Appendable dest)
Append a specified subsequence to an Appendable . |
void |
writeTo(int start,
int count,
java.io.Writer dest)
|
void |
writeTo(java.io.Writer dest)
|
Methods inherited from class gnu.lists.StableVector |
addPos, adjustPositions, allocPositionIndex, chainFreelist, consumePosRange, copyPos, createPos, endPos, fillPosRange, gapReserve, hasNext, isAfterPos, nextIndex, nextPos, releasePos, removePosRange, shiftGap, startPos, unchainFreelist |
Methods inherited from class gnu.lists.AbstractSequence |
add, addAll, addAll, append, append, append, baseUriOfPos, clear, compare, compare, compare, consume, consumeNext, contains, containsAll, createRelativePos, elements, equals, equals, fill, firstAttributePos, firstChildPos, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hashCode, hasPrevious, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, parentPos, previousPos, rank, remove, remove, removeAll, removePos, retainAll, set, setPosNext, setPosPrevious, stableCompare, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray |
CharBuffer
public CharBuffer(FString str)
CharBuffer
public CharBuffer(int initialSize)
length
public int length()
- Description copied from interface:
CharSeq
- Get length of string, in characters.
Synonym for size(), for compatibility with String and StringBuffer.
- Specified by:
length
in interface CharSeq
- Specified by:
length
in interface java.lang.CharSequence
charAt
public char charAt(int index)
- Specified by:
charAt
in interface CharSeq
- Specified by:
charAt
in interface java.lang.CharSequence
getChars
public void getChars(int srcBegin,
int srcEnd,
char[] dst,
int dstBegin)
- Copy characters into a destination buffer.
Same interface as java.lang.String's getChars.
- Specified by:
getChars
in interface CharSeq
setCharAt
public void setCharAt(int index,
char value)
- Specified by:
setCharAt
in interface CharSeq
subSequence
public java.lang.CharSequence subSequence(int start,
int end)
- Specified by:
subSequence
in interface CharSeq
- Specified by:
subSequence
in interface java.lang.CharSequence
fill
public void fill(int fromIndex,
int toIndex,
char value)
- Specified by:
fill
in interface CharSeq
fill
public final void fill(char value)
- Set all the elements to a given character.
- Specified by:
fill
in interface CharSeq
getArray
public char[] getArray()
delete
public void delete(int where,
int count)
insert
public void insert(int where,
java.lang.String str,
boolean beforeMarkers)
consume
public void consume(int start,
int count,
Consumer dest)
- Specified by:
consume
in interface CharSeq
toString
public java.lang.String toString()
- Specified by:
toString
in interface CharSeq
- Specified by:
toString
in interface java.lang.CharSequence
- Overrides:
toString
in class AbstractSequence
writeTo
public void writeTo(int start,
int count,
java.lang.Appendable dest)
throws java.io.IOException
- Description copied from interface:
CharSeq
- Append a specified subsequence to an
Appendable
.
An allowable implementation is:
dest.append(this, start, start+count)
.
Hence implementors of Appendable
should avoid calling
writeTo
- though they can call getChars
.
- Specified by:
writeTo
in interface CharSeq
- Throws:
java.io.IOException
writeTo
public void writeTo(java.lang.Appendable dest)
throws java.io.IOException
- Specified by:
writeTo
in interface CharSeq
- Throws:
java.io.IOException
writeTo
public void writeTo(int start,
int count,
java.io.Writer dest)
throws java.io.IOException
- Throws:
java.io.IOException
writeTo
public void writeTo(java.io.Writer dest)
throws java.io.IOException
- Throws:
java.io.IOException