Class MaskedString

java.lang.Object
org.drasyl.util.MaskedString

public final class MaskedString extends Object
Represents a confidential string (like a password or a secret token) whose content is masked in toString(). Do not use this class if the length of the string must not be revealed.
  • Method Details

    • toString

      public String toString()
      Returns a masked representation of this String. Each character is replaced with *.
      Overrides:
      toString in class Object
      Returns:
      masked representation of this String. Each character is replaced with *.
    • toUnmaskedString

      public String toUnmaskedString()
      Returns the unmasked representation of this String.
      Returns:
      unmasked representation of this String
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • of

      public static MaskedString of(String string)