public class GsmHelper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
decodeIA5(java.lang.String hexstring)
Convert a String containing hex-codes into the corresponding bytes.
|
static SmsMessage |
decodePDU(java.lang.String pdu,
boolean incoming,
boolean header)
Decode a GSM PDU String.
|
static java.lang.String |
encodeIA5(byte[] bytes)
Encode a byte array into a String containing hex codes.
|
static java.lang.String |
gsm2iso(java.lang.String str)
Convert a given string from GSM default alphabet to the ISO-8859-1 charset.
|
static java.lang.String |
iso2gsm(java.lang.String str)
Convert a given string from ISO-8859-1 to GSM default alphabet as specified in GSM 03.38.
|
public static java.lang.String iso2gsm(java.lang.String str)
Char | Unicode |
---|---|
Δ (Greek Alphabet Delta) | \u0394 |
Φ (Greek Alphabet Phi) | \u03A6 |
Γ (Greek Alphabet Gamma) | \u0393 |
Λ (Greek Alphabet Lambda) | \u039B |
Ω (Greek Alphabet Omega) | \u03A9 |
Π (Greek Alphabet Pi) | \u03A0 |
Ψ (Greek Alphabet Psi) | \u03A8 |
Σ (Greek Alphabet Sigma) | \u03A3 |
Θ (Greek Alphabet Theta) | \u0398 |
Ξ (Greek Alphabet Xi) | \u039E |
€ (Euro) | \u20AC |
String gsm = GsmHelper.iso2gsm("The price is 49 \u20AC"); // The price is 49 €
str
- the string to convert.gsm2iso(String)
public static java.lang.String gsm2iso(java.lang.String str)
iso2gsm(String)
.str
- GSM string to convert.public static SmsMessage decodePDU(java.lang.String pdu, boolean incoming, boolean header) throws ParseException
pdu
- the PDU Stringincoming
- true if the PDU is incoming (received by SMSC), false
if the PDU is outgoing (sent to SMSC).header
- true if the PDU string contains a SMSC header (GSM 07.05),
false otherwise.ParseException
- if parsing of the PDU string failspublic static byte[] decodeIA5(java.lang.String hexstring)
hexstring
- a string containing a hexadecimal representation of n bytes.encodeIA5(byte[])
public static java.lang.String encodeIA5(byte[] bytes)
decodeIA5(String)
object XP, Inc. © 2000-2013. All rights reserved object XP