public class Bitmap extends Object
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
m_bitmap
The underlying byte array.
|
| Constructor and Description |
|---|
Bitmap(byte[] data)
Creates a new Bitmap.
|
Bitmap(int length)
Creates a new Bitmap.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
allBitsCleared()
Returns true if all of the bits in this Bitmap are cleared (0).
|
boolean |
allBitsSet()
Returns true if all of the bits in this Bitmap are set (1).
|
void |
clearBit(int bit)
Clears a specific bit in this Bitmap.
|
byte[] |
getBytes()
Returns a reference to this Bitmap's data.
|
boolean |
isBitSet(int bit)
Returns true if a specific bit is set in this Bitmap.
|
int |
length()
Returns the length of this Bitmap.
|
static void |
main(String[] args)
Tests this class.
|
void |
setBit(int bit)
Sets a specific bit in this Bitmap.
|
void |
setBits(int value,
int offset,
int length)
Sets a subset of this Bitmap to a given value.
|
void |
setByte(int index,
byte value)
Sets a byte in this Bitmap's data.
|
long |
toLong()
Returns the long value of this Bitmap.
|
long |
toLong(int offset,
int length)
Returns the long value of this Bitmap.
|
public Bitmap(int length)
length - the length (in bytes).public Bitmap(byte[] data)
data - the byte array to use for this Bitmap's underlying data.public static void main(String[] args)
public boolean allBitsCleared()
public boolean allBitsSet()
public byte[] getBytes()
public int length()
public long toLong()
public long toLong(int offset,
int length)
offset - the offset of the value in this Bitmap.length - the length (in bytes) of the value.ArrayIndexOutOfBoundsException - if offset > this.length() - 1
or length > this.length() - 1 - offset
or offset < 0public void setByte(int index,
byte value)
index - the index of this Bitmap's data whose value to set.value - the byte value to set.public void setBit(int bit)
bit - the bit to set: between 0..this.length() - 1.ArrayIndexOutOfBoundsException - if bit > buffer.length - 1public void clearBit(int bit)
bit - the bit to set: between 0..this.length() - 1.ArrayIndexOutOfBoundsException - if bit > buffer.length - 1public boolean isBitSet(int bit)
bit - the bit to check: between 0..this.length() - 1.public void setBits(int value,
int offset,
int length)
value - the int value to set.offset - the bit offset (from the left) where the value will begin.length - the length (in bits) of the value.
length > 32, this method will set
length to 32 (int values are 32 bits long).Copyright © 2025. All rights reserved.