public class GSM7BitPacking extends Object
The common "unpacked" format stores one 7-bit value per byte. This is the format expected by the GSM7BitAlphabet class.
See 3GPP TS 23.038 section 6.1.2 for further details on the packing rules used.
Modifier and Type | Method and Description |
---|---|
static int |
getPackedSMSSize(int count)
Compute the number of bytes needed for SMS/CBS packing.
|
static int |
getPackedUSSDSize(byte[] src,
int srcpos,
int count)
Compute the number of bytes needed for USSD packing.
|
static int |
getUnpackedSMSSize(int count)
Compute the number of bytes needed for SMS/CBS unpacking.
|
static int |
getUnpackedUSSDSize(byte[] src,
int srcpos,
int bytecount)
Compute the number of bytes needed for USSD unpacking.
|
static void |
packSMS(byte[] src,
int srcpos,
byte[] dst,
int dstpos,
int count)
Pack from bytes to 7-bit fields, using the SMS/CBS packing rules.
|
static int |
packUSSD(byte[] src,
int srcpos,
byte[] dst,
int dstpos,
int count)
Pack from bytes to 7-bit fields, using the USSD packing rules.
|
static void |
unpackSMS(byte[] src,
int srcpos,
byte[] dst,
int dstpos,
int count)
Unpack a 7-bit packed value to a series of 8-bit aligned values,
using the SMS/CBS packing rules.
|
static int |
unpackUSSD(byte[] src,
int srcpos,
byte[] dst,
int dstpos,
int bytecount)
Unpack a 7-bit packed value to a series of 8-bit aligned values,
using the USSD packing rules.
|
public static void unpackSMS(byte[] src, int srcpos, byte[] dst, int dstpos, int count)
src
- the array to unpack fromsrcpos
- the offset within src (in bytes) to start atdst
- the array to unpack todstpos
- the offset within dst (in bytes) to start atcount
- the number of values to unpackpublic static int unpackUSSD(byte[] src, int srcpos, byte[] dst, int dstpos, int bytecount)
src
- the array to unpack fromsrcpos
- the offset within src (in bytes) to start atdst
- the array to unpack todstpos
- the offset within dst (in bytes) to start atbytecount
- the number of *bytes* to unpackpublic static void packSMS(byte[] src, int srcpos, byte[] dst, int dstpos, int count)
src
- the array to pack fromsrcpos
- the offset within src (in bytes) to start atdst
- the array to pack todstpos
- the offset within dst (in bytes) to start atcount
- the number of values to packpublic static int packUSSD(byte[] src, int srcpos, byte[] dst, int dstpos, int count)
src
- the array to pack fromsrcpos
- the offset within src (in bytes) to start atdst
- the array to pack todstpos
- the offset within dst (in bytes) to start atcount
- the number of values to packpublic static int getUnpackedSMSSize(int count)
count
- the number of values to unpackunpackSMS(byte[], int, byte[], int, int)
will use given the same parameterspublic static int getPackedSMSSize(int count)
count
- the number of values to packpackSMS(byte[], int, byte[], int, int)
will use given the same parameterspublic static int getUnpackedUSSDSize(byte[] src, int srcpos, int bytecount)
src
- the array to unpack fromsrcpos
- the offset within src (in bytes) to start atbytecount
- the number of *bytes* to unpackunpackUSSD(byte[], int, byte[], int, int)
will use given the same parameterspublic static int getPackedUSSDSize(byte[] src, int srcpos, int count)
src
- the array to pack fromsrcpos
- the offset within src (in bytes) to start atcount
- the number of values to packpackUSSD(byte[], int, byte[], int, int)
will use given the same parameters