public class FString extends AbstractCharVector<Char> implements java.lang.Appendable, CharSeq, Consumable
data, empty
COPY_ON_WRITE, GAP_FLAG, info, MAX_GAP_SIZE, READ_ONLY_FLAG, SHARED_FLAG, SUBRANGE_FLAG, VERY_SIMPLE_FLAG
noInts
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, ELEMENT_VALUE, EOF_VALUE, eofValue, FLOAT_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
Constructor and Description |
---|
FString() |
FString(char[] values)
Create an FString from a char[].
|
FString(char[] buffer,
int offset,
int length)
This constructor makes a copy.
|
FString(java.lang.CharSequence seq) |
FString(java.lang.CharSequence seq,
int offset,
int length)
Copy a substring of a CharSequence.
|
FString(int num) |
FString(int num,
int value) |
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(java.lang.CharSequence s) |
void |
addAllStrings(java.lang.Object[] args,
int startIndex)
Append arguments to this FString.
|
static FString |
alloc(int sz)
Create a empty string, but with a given initial buffer size.
|
FString |
append(char c) |
FString |
append(java.lang.CharSequence csq) |
FString |
append(java.lang.CharSequence csq,
int start,
int end) |
FString |
append(java.lang.Object obj) |
FString |
appendCharacter(int c)
Append a Unicode code point.
|
int |
characterAt(int index) |
void |
consumePosRange(int iposStart,
int iposEnd,
Consumer out) |
FString |
copy(int start,
int end) |
int |
createPos(int index,
boolean isAfter)
Generate a position at a given index.
|
int |
createRelativePos(int pos,
int delta,
boolean isAfter) |
int |
effectiveIndex(int index) |
boolean |
equals(java.lang.Object obj)
Must override, since we override hashCode.
|
Char |
get(int index)
See java.util.List.
|
int |
getElementKind() |
Char |
getRaw(int index)
Given an "effective index", return element as object.
|
java.lang.String |
getTag()
This is convenience hack for printing "uniform vectors" (srfi 4).
|
int |
indexOf(int ch,
int fromChar) |
void |
insert(int where,
int ch,
boolean beforeMarkers) |
void |
insert(int where,
java.lang.String str,
boolean beforeMarkers) |
void |
insertRepeated(int where,
int value,
int count) |
int |
lastIndexOf(int ch,
int fromChar) |
protected FString |
newInstance(int newLength) |
protected int |
nextIndex(int ipos)
Get the offset from the beginning corresponding to a position cookie.
|
FString |
prepend(java.lang.CharSequence str,
int start,
int end) |
FString |
prepend(java.lang.Object obj) |
FString |
prependCharacter(int c) |
void |
replace(java.lang.CharSequence src,
int srcStart,
int srcEnd,
int dstStart,
int dstEnd)
Replace a substring of this string with another.
|
void |
replace(int where,
char[] chars,
int start,
int count) |
void |
replace(int where,
java.lang.String string) |
Char |
set(int index,
Char value)
See java.util.List.
|
void |
setCharacterAt(int index,
int ch) |
void |
setCharAt(int index,
char ch) |
void |
setCharAtBuffer(int index,
char ch) |
void |
setRaw(int index,
Char value)
Given an "effective index", set selected element.
|
void |
shift(int srcStart,
int dstStart,
int count) |
int |
size()
See java.util.List.
|
CharSeq |
subSequence(int start,
int end) |
java.lang.String |
substring(int start,
int end) |
char[] |
toCharArray()
Return a char[] contain the characters of this string.
|
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 . |
charAt, clearBuffer, compareTo, compareTo, compareTo, copyBuffer, ensureBufferLength, equals, getBuffer, getBufferLength, getCharRaw, getChars, hashCode, length, openReader, openReader, setBuffer
add, add, addPos, addSpace, asImmutable, checkCanWrite, delete, doCopyOnWrite, fill, forEach, gapReserve, gapReserveGeneric, getGapEnd, getGapSize, getGapStart, getOffsetBits, getRowMajor, getSegment, getSegment, getSegmentReadOnly, getSizeBits, isAfterPos, isGapBuffer, isReadOnly, isSubRange, isVerySimple, readExternal, setGapBounds, setGapBounds, setInfoField, setReadOnly, toDataArray, writeExternal
addAll, addAll, badRank, boundedHash, checkRank, clear, compare, compare, compare, consume, consume, consumeNext, contains, containsAll, copyPos, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, elements, endPos, equals, fill, fillPosRange, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, get, get, get, getAttribute, getAttributeLength, getBooleanRaw, getByteRaw, getContainingSequenceSize, getDoubleRaw, getFloatRaw, getIndexDifference, getInt, getInt, getInt, getInt, getInt, getIntRaw, getIterator, getIterator, getIteratorAtPos, getLongRaw, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getShortRaw, getSize, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hasNext, hasPrevious, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, setAt, setPosNext, setPosPrevious, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported, unsupportedException
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, add, addAll, addAll, clear, contains, containsAll, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
consume
boundedHash
effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, get, get, get, get, getBooleanRaw, getByteRaw, getDoubleRaw, getFloatRaw, getInt, getInt, getInt, getInt, getInt, getIntRaw, getLongRaw, getLowBound, getShortRaw, getSize, getSize, isEmpty, rank, set
public FString()
public FString(int num)
public FString(int num, int value)
public FString(char[] values)
public FString(char[] buffer, int offset, int length)
public FString(java.lang.CharSequence seq)
public FString(java.lang.CharSequence seq, int offset, int length)
offset
- - start offset in 16-bit char unitslength
- - length in 16-bit char unitspublic int size()
Sequence
public int effectiveIndex(int index)
effectiveIndex
in interface Array<Char>
effectiveIndex
in class SimpleVector<Char>
index
- measured in Unicode code points (characters)public int createPos(int index, boolean isAfter)
AbstractSequence
createPos
in class AbstractSequence<Char>
index
- offset from beginning of desired positionisAfter
- should the position have the isAfter propertyprotected int nextIndex(int ipos)
AbstractSequence
nextIndex
in class AbstractSequence<Char>
public int createRelativePos(int pos, int delta, boolean isAfter)
createRelativePos
in class AbstractSequence<Char>
public static FString alloc(int sz)
public final Char getRaw(int index)
Array
public final Char get(int index)
Sequence
public int indexOf(int ch, int fromChar)
fromChar
- offset in 16-bit code unitspublic int lastIndexOf(int ch, int fromChar)
fromChar
- offset in 16-bit code unitspublic Char set(int index, Char value)
Sequence
public final void setRaw(int index, Char value)
AbstractSequence
public final int characterAt(int index)
index
- offset in 16-bit code unitspublic char[] toCharArray()
public void shift(int srcStart, int dstStart, int count)
shift
in class SimpleVector<Char>
public FString copy(int start, int end)
public boolean addAll(java.lang.CharSequence s)
public void insert(int where, int ch, boolean beforeMarkers)
public void insert(int where, java.lang.String str, boolean beforeMarkers)
public void addAllStrings(java.lang.Object[] args, int startIndex)
args
- an array of FString valuestartIndex
- index of first string in args
to usepublic java.lang.String toString()
toString
in interface CharSeq
toString
in interface java.lang.CharSequence
toString
in class AbstractSequence<Char>
public java.lang.String substring(int start, int end)
public CharSeq subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public void setCharacterAt(int index, int ch)
setCharacterAt
in interface CharSeq
public void replace(java.lang.CharSequence src, int srcStart, int srcEnd, int dstStart, int dstEnd)
public void setCharAtBuffer(int index, char ch)
public void insertRepeated(int where, int value, int count)
public void replace(int where, char[] chars, int start, int count)
public void replace(int where, java.lang.String string)
public boolean equals(java.lang.Object obj)
AbstractCharVector
equals
in interface java.util.Collection<Char>
equals
in interface java.util.List<Char>
equals
in class AbstractCharVector<Char>
protected FString newInstance(int newLength)
newInstance
in class SimpleVector<Char>
public int getElementKind()
getElementKind
in interface Array<Char>
getElementKind
in class AbstractSequence<Char>
public java.lang.String getTag()
SimpleVector
getTag
in class SimpleVector<Char>
public void consumePosRange(int iposStart, int iposEnd, Consumer out)
consumePosRange
in class AbstractSequence<Char>
public FString append(char c)
append
in interface java.lang.Appendable
public FString appendCharacter(int c)
public FString append(java.lang.CharSequence csq)
append
in interface java.lang.Appendable
public FString append(java.lang.CharSequence csq, int start, int end)
append
in interface java.lang.Appendable
public FString append(java.lang.Object obj)
public FString prependCharacter(int c)
public FString prepend(java.lang.CharSequence str, int start, int end)
public FString prepend(java.lang.Object obj)
public void writeTo(int start, int count, java.lang.Appendable dest) throws java.io.IOException
CharSeq
Appendable
.
An allowable implementation is:
dest.append(this, start, start+count)
.
Hence implementors of Appendable
should avoid calling
writeTo
- though they can call getChars
.