Package com.nulabinc.zxcvbn
Class WipeableString
- java.lang.Object
-
- com.nulabinc.zxcvbn.WipeableString
-
- All Implemented Interfaces:
java.lang.CharSequence
public class WipeableString extends java.lang.Object implements java.lang.CharSequenceA character sequence with many attributes of Strings, but that can have its content wiped.
-
-
Constructor Summary
Constructors Constructor Description WipeableString(char[] source)Creates a new wipeable string, copying the content from the specified source.WipeableString(java.lang.CharSequence source)Creates a new wipeable string, copying the content from the specified source.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description char[]charArray()Returns a copy of the content as a char array.charcharAt(int index)intcodePointAt(int index)Returns the nth Unicode code point.static WipeableStringcopy(java.lang.CharSequence source, int start, int end)Returns a copy of a portion of a character sequence as a wipeable string.booleanequals(java.lang.Object obj)inthashCode()intindexOf(char character)Returns the position of the first match of the specified character (indexed from 0).booleanisWiped()Returns true if the wipeable string has been wiped.intlength()static WipeableStringlowerCase(java.lang.CharSequence source)Returns a new wipeable string with the specified content forced into lower case.static intparseInt(java.lang.CharSequence s)A version of Integer.parse(String) that accepts CharSequence as parameter.static intparseInt(java.lang.CharSequence s, int radix)A version of Integer.parse(String) that accepts CharSequence as parameter.static WipeableStringreversed(java.lang.CharSequence source)Returns a new wipeable string with the specified content but with the order of the characters reversed.WipeableStringsubSequence(int start, int end)java.lang.StringtoString()voidwipe()Wipe the content of the wipeable string.static voidwipeIfPossible(java.lang.CharSequence text)Wipes the content of the specified character sequence if possible.
-
-
-
Method Detail
-
length
public int length()
- Specified by:
lengthin interfacejava.lang.CharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfacejava.lang.CharSequence
-
subSequence
public WipeableString subSequence(int start, int end)
- Specified by:
subSequencein interfacejava.lang.CharSequence
-
wipe
public void wipe()
Wipe the content of the wipeable string. Overwrites the content buffer with spaces, then replaces the buffer with an empty one.
-
lowerCase
public static WipeableString lowerCase(java.lang.CharSequence source)
Returns a new wipeable string with the specified content forced into lower case.
-
reversed
public static WipeableString reversed(java.lang.CharSequence source)
Returns a new wipeable string with the specified content but with the order of the characters reversed.
-
copy
public static WipeableString copy(java.lang.CharSequence source, int start, int end)
Returns a copy of a portion of a character sequence as a wipeable string.
-
indexOf
public int indexOf(char character)
Returns the position of the first match of the specified character (indexed from 0).
-
codePointAt
public int codePointAt(int index)
Returns the nth Unicode code point.
-
isWiped
public boolean isWiped()
Returns true if the wipeable string has been wiped.
-
charArray
public char[] charArray()
Returns a copy of the content as a char array.
-
parseInt
public static int parseInt(java.lang.CharSequence s) throws java.lang.NumberFormatExceptionA version of Integer.parse(String) that accepts CharSequence as parameter.- Throws:
java.lang.NumberFormatException
-
parseInt
public static int parseInt(java.lang.CharSequence s, int radix) throws java.lang.NumberFormatExceptionA version of Integer.parse(String) that accepts CharSequence as parameter.- Throws:
java.lang.NumberFormatException
-
toString
public java.lang.String toString()
- Specified by:
toStringin interfacejava.lang.CharSequence- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
wipeIfPossible
public static void wipeIfPossible(java.lang.CharSequence text)
Wipes the content of the specified character sequence if possible. The following types can be wiped... WipeableString StringBuilder StringBuffer CharBuffer (if not readOnly)
-
-