Package ghidra.program.model.lang
Class MaskImpl
- java.lang.Object
- 
- ghidra.program.model.lang.MaskImpl
 
- 
- All Implemented Interfaces:
- Mask,- java.io.Serializable
 
 public class MaskImpl extends java.lang.Object implements Mask, java.io.Serializable Implements the Mask interface as a byte array.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description MaskImpl(byte[] msk)Construct a mask from a byte array.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]applyMask(byte[] cde, byte[] result)Apply the mask to a byte array.voidapplyMask(byte[] cde, int cdeOffset, byte[] results, int resultsOffset)Apply the mask to a byte array.byte[]applyMask(MemBuffer buffer)Apply the mask to a memory buffer.byte[]complementMask(byte[] msk, byte[] results)applies the complement of the mask to the given byte array.booleanequalMaskedValue(byte[] cde, byte[] target)Tests if the results of apply the mask to the given array matches a target array.booleanequals(byte[] otherMask)Check if the mask represented by the byte array is equal to this one.booleanequals(java.lang.Object obj)Test if the given object is equal to this object.byte[]getBytes()Returns the bytes that make up this mask.booleansubMask(byte[] msk)Tests if the given mask matches the this mask for the first n bytes, where n is the size of the given mask.java.lang.StringtoString()
 
- 
- 
- 
Method Detail- 
equalspublic boolean equals(java.lang.Object obj) Description copied from interface:MaskTest if the given object is equal to this object. Two masks are equal if they have exactly the same values in thier byte arrays.
 - 
equalspublic boolean equals(byte[] otherMask) Description copied from interface:MaskCheck if the mask represented by the byte array is equal to this one.- Specified by:
- equalsin interface- Mask
- Parameters:
- otherMask- mask represented as byte array
- Returns:
- true if the masks are the same, false otherwise
- See Also:
- Mask.equals(byte[])
 
 - 
applyMaskpublic byte[] applyMask(byte[] cde, byte[] result) throws IncompatibleMaskExceptionDescription copied from interface:MaskApply the mask to a byte array.- Specified by:
- applyMaskin interface- Mask
- Parameters:
- cde- the array that contains the values to be masked
- result- the array to contain the results.
- Returns:
- the resulting byte array.
- Throws:
- IncompatibleMaskException- thrown if byte arrays are not of the correct size
- See Also:
- Mask.applyMask(byte[], byte[])
 
 - 
applyMaskpublic void applyMask(byte[] cde, int cdeOffset, byte[] results, int resultsOffset) throws IncompatibleMaskExceptionDescription copied from interface:MaskApply the mask to a byte array.- Specified by:
- applyMaskin interface- Mask
- Parameters:
- cde- the array that contains the values to be masked
- cdeOffset- the offset into the array that contains the values to be masked
- results- the array to contain the results.
- resultsOffset- the offset into the array that contains the results
- Throws:
- IncompatibleMaskException- thrown if byte arrays are not of the correct size
 
 - 
applyMaskpublic byte[] applyMask(MemBuffer buffer) throws MemoryAccessException Description copied from interface:MaskApply the mask to a memory buffer.- Specified by:
- applyMaskin interface- Mask
- Parameters:
- buffer- the memory buffer that contains the values to be masked
- Returns:
- the resulting masked byte array.
- Throws:
- MemoryAccessException- thrown if mask exceeds the available data within buffer
- See Also:
- Mask.applyMask(ghidra.program.model.mem.MemBuffer)
 
 - 
equalMaskedValuepublic boolean equalMaskedValue(byte[] cde, byte[] target) throws IncompatibleMaskExceptionDescription copied from interface:MaskTests if the results of apply the mask to the given array matches a target array.- Specified by:
- equalMaskedValuein interface- Mask
- Parameters:
- cde- the source bytes.
- target- the result bytes to be tested.
- Returns:
- true if the target array is equal to the source array with the mask applied.
- Throws:
- IncompatibleMaskException- thrown if byte arrays are not of the correct size
- See Also:
- Mask.equalMaskedValue(byte[], byte[])
 
 - 
subMaskpublic boolean subMask(byte[] msk) throws IncompatibleMaskExceptionDescription copied from interface:MaskTests if the given mask matches the this mask for the first n bytes, where n is the size of the given mask.- Specified by:
- subMaskin interface- Mask
- Parameters:
- msk- the bytes to be tested to see if they match the first bytes of this mask.
- Returns:
- true if the bytes match up to the length of the passed in byte array.
- Throws:
- IncompatibleMaskException- thrown if byte arrays are not of the correct size
- See Also:
- Mask.subMask(byte[])
 
 - 
complementMaskpublic byte[] complementMask(byte[] msk, byte[] results) throws IncompatibleMaskExceptionDescription copied from interface:Maskapplies the complement of the mask to the given byte array.- Specified by:
- complementMaskin interface- Mask
- Parameters:
- msk- the bytes to apply the inverted mask.
- results- the array for storing the results.
- Returns:
- the results array.
- Throws:
- IncompatibleMaskException- thrown if byte arrays are not of the correct size
- See Also:
- Mask.complementMask(byte[], byte[])
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
- See Also:
- Object.toString()
 
 - 
getBytespublic byte[] getBytes() Description copied from interface:MaskReturns the bytes that make up this mask.- Specified by:
- getBytesin interface- Mask
- See Also:
- Mask.getBytes()
 
 
- 
 
-