fm.liveswitch.Utf8 Class Reference

UTF-8 encoding/decoding utility. More...

Public Member Functions

 Utf8 ()
 

Static Public Member Functions

static String decode (fm.liveswitch.DataBuffer buffer)
 Decodes a UTF-8 data buffer to a string. More...
 
static String decode (byte[] input)
 Decodes a UTF-8 byte array to a string. More...
 
static String decode (byte[] input, int index, int length)
 Decodes a UTF-8 byte array to a string. More...
 
static byte[] encode (String input)
 Encodes a string to a UTF-8 byte array. More...
 
static int getByteCount (String input)
 Gets the number of bytes that would be returned by a call to encode. More...
 

Detailed Description

UTF-8 encoding/decoding utility.

Constructor & Destructor Documentation

◆ Utf8()

fm.liveswitch.Utf8.Utf8 ( )

Member Function Documentation

◆ decode() [1/3]

static String fm.liveswitch.Utf8.decode ( byte[]  input)
static

Decodes a UTF-8 byte array to a string.

Parameters
inputThe input byte array.

◆ decode() [2/3]

static String fm.liveswitch.Utf8.decode ( byte[]  input,
int  index,
int  length 
)
static

Decodes a UTF-8 byte array to a string.

Parameters
inputThe input byte array.
indexThe index to start reading.
lengthThe length.

◆ decode() [3/3]

static String fm.liveswitch.Utf8.decode ( fm.liveswitch.DataBuffer  buffer)
static

Decodes a UTF-8 data buffer to a string.

Parameters
bufferThe input byte array.

◆ encode()

static byte [] fm.liveswitch.Utf8.encode ( String  input)
static

Encodes a string to a UTF-8 byte array.

Parameters
inputThe input string.

◆ getByteCount()

static int fm.liveswitch.Utf8.getByteCount ( String  input)
static

Gets the number of bytes that would be returned by a call to encode.

Parameters
inputThe input string.