BitmaskTools

com.anywherecommerce.android.sdk.util

Class BitmaskTools

  • java.lang.Object

  • com.anywherecommerce.android.sdk.util.BitmaskTools

  • public class <span class="typeNameLabel">BitmaskTools</span>
    extends java.lang.Object
    

Constructor Summary

  Constructor and Description`<span class="memberNameLink">

BitmaskTools()`

Method Summary

  Modifier and TypeMethod and Description`static java.lang.String``<span class="memberNameLink">

bitSetToHexString(java.util.BitSet bitSet) static java.util.BitSet``

fromByteAlignedString(java.lang.String binaryString)`returns BitSet representing input binary string that must represent byte data in big endian format Valid inputs are "00001111" or "0000 1111", spaces are trimmed

  `static java.util.BitSet````
  <span class="memberNameLink">

fromByteAlignedString(java.lang.String binaryString,
boolean littleEndian)
```returns BitSet representing input binary string that must represent byte data in either little/big endian format Valid inputs are "00001111" or "0000 1111", spaces are trimmed

  `static java.util.BitSet``<span class="memberNameLink">

fromString(java.lang.String binaryString)`returns BitSet representing input string containing a binary number Valid inputs are "00001111" or "0000 1111", spaces are trimmed

  `static java.lang.String````
  <span class="memberNameLink">

getBits(java.lang.String hexString,
int startBit,
int endBit)
```returns a string representing the bits requested for a given hexString Given a hex string of say "0F", and a startbit of 0, and end bit of 6, it will return the string "00001"

  `static java.util.BitSet``<span class="memberNameLink">

hexToBitSet(java.lang.String hexString) static boolean````

isMatch(java.lang.String hexString,
java.lang.String bitMask)
```returns true if hexString matches bitMask each bit position in the string bitMask can be either 1, 0, or x, where x specifies "we don't care".

Methods inherited from class java.lang.Object

        `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

BitmaskTools

        `public BitmaskTools()`

Method Detail

hexToBitSet

        `public static java.util.BitSet hexToBitSet(java.lang.String hexString)`

bitSetToHexString

        `public static java.lang.String bitSetToHexString(java.util.BitSet bitSet)`

fromByteAlignedString

        `public static java.util.BitSet fromByteAlignedString(java.lang.String binaryString)`returns BitSet representing input binary string that must represent byte data in big endian format Valid inputs are "00001111" or "0000 1111", spaces are trimmed
        
        Parameters:`binaryString` must be a string consisting of either 0, 1, or a spaceReturns:BitSet

fromByteAlignedString

        ```
        public static java.util.BitSet fromByteAlignedString(java.lang.String binaryString,
                                                             boolean littleEndian)
        ```
        returns BitSet representing input binary string that must represent byte data in either little/big endian format Valid inputs are "00001111" or "0000 1111", spaces are trimmed
        
        Parameters:`String` binaryString must be a string consisting of either 0, 1, or a space`boolean` littleEndianReturns:BitSet

fromString

        `public static java.util.BitSet fromString(java.lang.String binaryString)`returns BitSet representing input string containing a binary number Valid inputs are "00001111" or "0000 1111", spaces are trimmed
        
        Parameters:`binaryString` must be a string consisting of either 0, 1, or a spaceReturns:

isMatch

        ```
        public static boolean isMatch(java.lang.String hexString,
                                      java.lang.String bitMask)
        ```
        returns true if hexString matches bitMask each bit position in the string bitMask can be either 1, 0, or x, where x specifies "we don't care". for example, a hex value of "03" is represented in bits as 0000 0011, will match to a bitmask of "00000011" or "0000xxx1"
        
        Parameters:`hexString` must be a string consisting of hex characters or space`bitMask` must be a string consisting of '0', '1', 'x' or spaceReturns:boolean

getBits

        ```
        public static java.lang.String getBits(java.lang.String hexString,
                                               int startBit,
                                               int endBit)
        ```
        returns a string representing the bits requested for a given hexString Given a hex string of say "0F", and a startbit of 0, and end bit of 6, it will return the string "00001"
        
        Parameters:`hexString` must be a string consisting of hex characters or space`startBit` non-negative int`endBit` int >= startBitReturns:String