public class SecureByteArray extends Object
| Constructor and Description |
|---|
SecureByteArray() |
SecureByteArray(byte[] bytes) |
SecureByteArray(char[] chars) |
SecureByteArray(int size) |
SecureByteArray(SecureByteArray copy) |
SecureByteArray(String str)
Creates the object from a string (don't pass passwords in this way).
|
| Modifier and Type | Method and Description |
|---|---|
void |
append(SecureByteArray arr)
Appends another SecureByteArray to this one.
|
void |
erase()
Erases the data in this array by writing a pattern over every element
of the array.
|
byte |
getByteAt(int index)
Obtains the byte at an index.
|
byte[] |
getData()
Returns a reference to the data.
|
void |
prepend(SecureByteArray arr)
Prepends this array with another SecureByteArray.
|
void |
replace(SecureByteArray arr)
Replaces the contents of this array with a copy of those in arr, resizing
the array as needed.
|
void |
resize(int size,
boolean retainData)
Resizes the array, optionally keeping the old data.
|
void |
setByteAt(int index,
byte c)
Sets the byte at an index.
|
int |
size()
Gets the size of this array.
|
public SecureByteArray()
public SecureByteArray(int size)
public SecureByteArray(byte[] bytes)
public SecureByteArray(char[] chars)
public SecureByteArray(SecureByteArray copy)
public SecureByteArray(String str)
str - The string object to get the data from.public void append(SecureByteArray arr) throws Exception
arr - The array to append.Exception - Upon size problems. (lol)public void erase()
public byte getByteAt(int index)
throws ArrayIndexOutOfBoundsException
index - The index to obtain the byte at.ArrayIndexOutOfBoundsException - Upon bad index.public byte[] getData()
public void prepend(SecureByteArray arr) throws Exception
arr - The array to prepend.Exception - Upon size problems. (lol)public void replace(SecureByteArray arr) throws Exception
arr - The copy to use.Exceptionpublic void resize(int size,
boolean retainData)
throws Exception
size - The new size of the array. This must be 1 or larger.retainData - Whether or not to keep the old data.Exception - If the size is 0 or less.public void setByteAt(int index,
byte c)
throws ArrayIndexOutOfBoundsException
index - The index to set at.c - The byte to set.ArrayIndexOutOfBoundsException - Upon bad index.public int size()
Copyright © 2014. All rights reserved.