Version

GSMCharset

public class GSMCharset
extends:
    java.nio.charset.Charset
Implements:
    Comparable<Charset>
GSMCharset is a specialized implementation of java.nio.charset.Charset designed to handle GSM 7-bit encoding, used in SMS transmission. It includes logic for character validation, encoding length estimation, and message slicing based on GSM character set rules.

Fields:

ESCAPE, GSM_CANONICAL_NAME

Constructors:

public GSMCharset(String canonicalName, String[] aliases)
Initializes the charset using only name and aliases.

public GSMCharset(String canonicalName, String[] aliases, int[] mainTable, int[] extentionTable)
Initializes the charset using name, aliases, and both encoding tables (main and extended).

Methods:

boolean contains(Charset cs) Indicates whether the given charset is a subset of GSMCharset.
CharsetDecoder newDecoder() Creates a new decoder for this charset.
CharsetEncoder newEncoder() Creates a new encoder for this charset.
boolean checkAllCharsCanBeEncoded(String data) Returns true if all characters in the string are present in the main or extension GSM7 tables.
static boolean checkAllCharsCanBeEncoded(String data, int[] mainTable, int[] extentionTable) Same as above, with custom tables.
int checkEncodedDataLengthInChars(String data) Returns the character count (septets) for the GSM7-encoded form of the input string. Extension chars count as two.
static int checkEncodedDataLengthInChars(String data, int[] mainTable, int[] extentionTable) Same as above, with custom tables.
static int septetsToOctets(int septCnt) Converts a number of septets (7-bit units) into the number of octets (8-bit bytes) needed to store them.
static int octetsToSeptets(int byteCnt) Converts a number of octets into the number of septets they can represent.
String[] sliceString(String data, int charCount) Splits the input string into chunks that fit the given septet character limit.
static String[] sliceString(String data, int charCount, int[] mainTable, int[] extentionTable) Same as above, using custom encoding tables.

Methods inherited from class java.nio.charset.Charset

aliases, availableCharsets, canEncode, compareTo, decode, defaultCharset, displayName, displayName, encode, encode, equals, forName, hashCode, isRegistered, isSupported, name, toString

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Start innovating with Mobius

What's next? Let's talk!

Mobius Software

As a company you'll get:

  • Get started quickly

  • Support any business model

  • Join millions of businesses

Questions? websupport@mobius.com