Package io.bytestreams.codec.iso8583
Class SingleBlockBitmap
java.lang.Object
io.bytestreams.codec.iso8583.SingleBlockBitmap
- All Implemented Interfaces:
Bitmap
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcapacity()Returns the total number of bits in the bitmap.intReturns the number of bits that are set.booleanclear(int bit) Clears the given bit.booleanget(int bit) Checks if the given bit is set.booleanset(int bit) Sets the given bit.stream()Returns a stream of the 1-based indices of all set bits.byte[]Converts theBitmapto a byte array.toString()static SingleBlockBitmapvalueOf(byte[] bytes) Creates a new SingleBlockBitmap.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.bytestreams.codec.iso8583.Bitmap
isExtensionBit
-
Constructor Details
-
SingleBlockBitmap
public SingleBlockBitmap(int size) Creates a new SingleBlockBitmap.- Parameters:
size- the number of bytes in the block.
-
-
Method Details
-
valueOf
Creates a new SingleBlockBitmap.- Parameters:
bytes- the byte array representation of the bitmap.- Returns:
- the SingleBlockBitmap.
-
capacity
public int capacity()Description copied from interface:BitmapReturns the total number of bits in the bitmap. -
get
public boolean get(int bit) Checks if the given bit is set. -
set
public boolean set(int bit) Sets the given bit. -
clear
public boolean clear(int bit) Clears the given bit. -
cardinality
public int cardinality()Description copied from interface:BitmapReturns the number of bits that are set.- Specified by:
cardinalityin interfaceBitmap- Returns:
- the number of bits set in the
Bitmap.
-
stream
Description copied from interface:BitmapReturns a stream of the 1-based indices of all set bits. -
toByteArray
public byte[] toByteArray()Converts theBitmapto a byte array.- Specified by:
toByteArrayin interfaceBitmap- Returns:
- the byte array representation of the
Bitmap.
-
toString
-