java.lang.Object
org.minidns.util.SafeCharSequence
- All Implemented Interfaces:
CharSequence
A CharSequence whose toString() output is guaranteed safe to expose. Subclasses may override
toSafeString() if toString() is not safe.Constructor Summary
ConstructorsConstructorDescriptionA sequence with no fields of its own: subclasses supply the text through toSafeString(), so construction needs no arguments.Method Summary
All MethodsModifier and TypeMethodDescriptionfinal charcharAt(int index) Returns one character of the safe string form.final intlength()Counts the characters of the safe string form.final CharSequencesubSequence(int start, int end) Returns a safe substring of the safe string form.Return a safe string representation.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CharSequence
chars, codePoints, getChars, isEmpty, toString
Constructor Details
SafeCharSequence
public SafeCharSequence()A sequence with no fields of its own: subclasses supply the text through toSafeString(), so construction needs no arguments.
Method Details
length
public final int length()Counts the characters of the safe string form.- Specified by:
lengthin interfaceCharSequence
charAt
public final char charAt(int index) Returns one character of the safe string form.- Specified by:
charAtin interfaceCharSequence
subSequence
Returns a safe substring of the safe string form.- Specified by:
subSequencein interfaceCharSequence
toSafeString
Return a safe string representation. The default implementation assumes that toString() returns a safe representation. Subclasses may override toSafeString() if this assumption is not correct.- Returns:
- safe string representation