public final class MutableBytes extends Bytes implements AutoCloseable
Bytes created by calling Bytes.mutable(). If possible, all transformations are done in place, without creating a copy.
Adds additional mutator, which may change the internal array in-place, like wipe()
| Modifier and Type | Method and Description |
|---|---|
static MutableBytes |
allocate(int length)
Creates a new instance with an empty array filled with zeros.
|
static MutableBytes |
allocate(int length,
byte defaultValue)
Creates a new instance with an empty array filled with given defaultValue
|
void |
close() |
boolean |
equals(Object o)
Checks if this instance is equal to given other instance o
|
MutableBytes |
fill(byte fillByte)
Fills the internal byte array with provided byte
|
int |
hashCode() |
Bytes |
immutable()
Convert this instance to an immutable version with the same reference of the internal array and byte-order.
|
boolean |
isMutable()
Checks if instance is mutable
|
MutableBytes |
overwrite(byte[] newArray)
Uses given array to overwrite internal array
|
MutableBytes |
overwrite(byte[] newArray,
int offsetInternalArray)
Uses given array to overwrite internal array.
|
MutableBytes |
overwrite(Bytes newBytes)
Uses given Bytes array to overwrite internal array
|
MutableBytes |
overwrite(Bytes newBytes,
int offsetInternalArray)
Uses given Bytes array to overwrite internal array.
|
MutableBytes |
secureWipe()
Fills the internal byte array with random data provided by
SecureRandom |
MutableBytes |
secureWipe(SecureRandom random)
Fills the internal byte array with random data provided by given random instance
|
MutableBytes |
setByteAt(int index,
byte newByte)
Sets new byte to given index
|
MutableBytes |
wipe()
Fills the internal byte array with all zeros
|
and, and, append, append, append, append, append, append, append, append, append, append, appendNullSafe, array, bitAt, buffer, byteAt, byteOrder, byteOrder, charAt, compareTo, contains, copy, copy, count, count, duplicate, empty, encode, encodeBase32, encodeBase36, encodeBase64, encodeBase64, encodeBase64Url, encodeBinary, encodeCharset, encodeCharsetToBytes, encodeDec, encodeHex, encodeHex, encodeOctal, encodeRadix, encodeUtf8, encodeUtf8ToBytes, endsWith, entropy, equals, equals, equals, equalsConstantTime, equalsContent, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, from, fromNullSafe, hash, hashMd5, hashSha1, hashSha256, indexOf, indexOf, indexOf, indexOf, inputStream, intAt, isEmpty, isReadOnly, iterator, lastIndexOf, leftShift, length, lengthBit, longAt, mutable, not, or, or, parse, parseBase32, parseBase36, parseBase64, parseBinary, parseDec, parseHex, parseOctal, parseRadix, random, random, readOnly, resize, resize, reverse, rightShift, shortAt, startsWith, switchBit, switchBit, toBigInteger, toBitSet, toBoxedArray, toByte, toChar, toCharArray, toCharArray, toDouble, toDoubleArray, toFloat, toFloatArray, toInt, toIntArray, toList, toLong, toLongArray, toShort, toString, toUnsignedByte, toUUID, transform, unsecureRandom, unsecureRandom, unsignedByteAt, validate, validateNotOnlyZeros, wrap, wrap, wrap, wrapNullSafe, xor, xorclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static MutableBytes allocate(int length)
length - of the internal arraypublic static MutableBytes allocate(int length, byte defaultValue)
length - of the internal arraydefaultValue - to fill withpublic boolean isMutable()
Bytespublic MutableBytes overwrite(byte[] newArray)
newArray - used to overwrite internalIndexOutOfBoundsException - if newArray.length > internal lengthpublic MutableBytes overwrite(Bytes newBytes)
newBytes - used to overwrite internalIndexOutOfBoundsException - if newArray.length > internal lengthpublic MutableBytes overwrite(byte[] newArray, int offsetInternalArray)
newArray - used to overwrite internaloffsetInternalArray - index of the internal array to start overwritingIndexOutOfBoundsException - if newArray.length + offsetInternalArray > internal lengthpublic MutableBytes overwrite(Bytes newBytes, int offsetInternalArray)
newBytes - used to overwrite internaloffsetInternalArray - index of the internal array to start overwritingIndexOutOfBoundsException - if newBytes.length + offsetInternalArray > internal lengthpublic MutableBytes setByteAt(int index, byte newByte)
index - the index to changenewByte - the new byte to setpublic MutableBytes wipe()
public MutableBytes fill(byte fillByte)
fillByte - to fill withpublic MutableBytes secureWipe()
SecureRandompublic MutableBytes secureWipe(SecureRandom random)
random - to generate entropypublic Bytes immutable()
public boolean equals(Object o)
Bytespublic void close()
close in interface AutoCloseableCopyright © 2017–2019. All rights reserved.