public class IccUtils extends Object
Constructor and Description |
---|
IccUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
adnStringFieldToString(byte[] data,
int offset,
int length)
Decodes a string field that's formatted like the EF[ADN] alpha
identifier
From TS 51.011 10.5.1:
Coding:
this alpha tagging shall use either
- the SMS default 7 bit coded alphabet as defined in
TS 23.038 [12] with bit 8 set to 0.
|
static String |
bcdToString(byte[] data,
int offset,
int length)
Many fields in GSM SIM's are stored as nibble-swizzled BCD
Assumes left-justified field that may be padded right with 0xf
values.
|
static String |
bchToString(byte[] data,
int offset,
int length)
Some fields (like ICC ID) in GSM SIMs are stored as nibble-swizzled BCH
|
static String |
bytesToHexString(byte[] bytes)
Converts a byte array into a String of hexadecimal characters.
|
static int |
cdmaBcdByteToInt(byte b)
Decodes a CDMA style BCD byte like
gsmBcdByteToInt(byte) , but
opposite nibble format. |
static String |
cdmaBcdToString(byte[] data,
int offset,
int length)
Decode cdma byte into String.
|
static int |
gsmBcdByteToInt(byte b)
Decodes a GSM-style BCD byte, returning an int ranging from 0-99.
|
static byte[] |
hexStringToBytes(String s)
Converts a hex String to a byte array.
|
static String |
networkNameToString(byte[] data,
int offset,
int length)
Convert a TS 24.008 Section 10.5.3.5a Network Name field to a string
"offset" points to "octet 3", the coding scheme byte
empty string returned on decode error
|
static Bitmap |
parseToBnW(byte[] data,
int length)
Convert a TS 131.102 image instance of code scheme '11' into Bitmap
|
static Bitmap |
parseToRGB(byte[] data,
int length,
boolean transparency)
a TS 131.102 image instance of code scheme '11' into color Bitmap
|
public static String bcdToString(byte[] data, int offset, int length)
public static String bchToString(byte[] data, int offset, int length)
public static String cdmaBcdToString(byte[] data, int offset, int length)
public static int gsmBcdByteToInt(byte b)
public static int cdmaBcdByteToInt(byte b)
gsmBcdByteToInt(byte)
, but
opposite nibble format. The least significant BCD digit
is in the least significant nibble and the most significant
is in the most significant nibble.public static String adnStringFieldToString(byte[] data, int offset, int length)
public static byte[] hexStringToBytes(String s)
s
- A string of hexadecimal characters, must be an even number of
chars longRuntimeException
- on invalid formatpublic static String bytesToHexString(byte[] bytes)
bytes
- an array of bytespublic static String networkNameToString(byte[] data, int offset, int length)
public static Bitmap parseToBnW(byte[] data, int length)
data
- The raw datalength
- The length of image bodypublic static Bitmap parseToRGB(byte[] data, int length, boolean transparency)
data
- The raw datalength
- the length of image bodytransparency
- with or without transparency