Package dev.blaauwendraad.masker.json
Class MaskingState
java.lang.Object
dev.blaauwendraad.masker.json.MaskingState
Represents the state of the
JsonMasker at a given point in time during the JsonMasker.mask(byte[])
operation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a delayed replacement that requires resizing of the message byte array. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddReplacementOperation(int startIndex, int endIndex, int maskLength, byte maskByte) Adds new delayed replacement operation to the list of operations to be applied to the message.bytebyteintbyte[]Returns the list of replacement operations that need to be applied to the message.intReturns the total difference between the masks and target values lengths of all replacement operations.voidintvoidsetCurrentIndex(int currentIndex) voidsetMessage(byte[] newMessage) toString()
-
Constructor Details
-
MaskingState
public MaskingState(byte[] message, int currentIndex)
-
-
Method Details
-
incrementCurrentIndex
public void incrementCurrentIndex() -
setCurrentIndex
public void setCurrentIndex(int currentIndex) -
setMessage
public void setMessage(byte[] newMessage) -
byteAtCurrentIndex
public byte byteAtCurrentIndex() -
byteAtCurrentIndexMinusOne
public byte byteAtCurrentIndexMinusOne() -
currentIndex
public int currentIndex() -
messageLength
public int messageLength() -
getMessage
public byte[] getMessage() -
addReplacementOperation
public void addReplacementOperation(int startIndex, int endIndex, int maskLength, byte maskByte) Adds new delayed replacement operation to the list of operations to be applied to the message. -
getReplacementOperations
Returns the list of replacement operations that need to be applied to the message. -
getReplacementOperationsTotalDifference
public int getReplacementOperationsTotalDifference()Returns the total difference between the masks and target values lengths of all replacement operations. -
toString
-