Package org.gitlab4j.api.utils
Class SecretString
- java.lang.Object
-
- org.gitlab4j.api.utils.SecretString
-
- All Implemented Interfaces:
java.lang.AutoCloseable
,java.lang.CharSequence
public class SecretString extends java.lang.Object implements java.lang.CharSequence, java.lang.AutoCloseable
This class implements a CharSequence that can be cleared of it's contained characters. This class is utilized to pass around secrets (passwords) instead of a String instance.
-
-
Constructor Summary
Constructors Constructor Description SecretString(char[] chars)
SecretString(char[] chars, int start, int end)
SecretString(java.lang.CharSequence charSequence)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description char
charAt(int index)
void
clear()
Clear the contents of this SecretString instance by setting each character to 0.void
close()
void
finalize()
int
length()
java.lang.CharSequence
subSequence(int start, int end)
-
-
-
Method Detail
-
charAt
public char charAt(int index)
- Specified by:
charAt
in interfacejava.lang.CharSequence
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
length
public int length()
- Specified by:
length
in interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfacejava.lang.CharSequence
-
clear
public void clear()
Clear the contents of this SecretString instance by setting each character to 0. This is automatically done in the finalize() method.
-
finalize
public void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-