• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
EncodingUtils Class Reference

The home for utility methods that handle various encoding tasks. More...

Description

Author
Michael Becke
Oleg Kalnichevski
Since
4.0

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Static Public Member Functions

static String getString (final byte[] data, int offset, int length, String charset)
 Converts the byte array of HTTP content characters to a string. More...
 
static String getString (final byte[] data, final String charset)
 Converts the byte array of HTTP content characters to a string. More...
 
static byte[] getBytes (final String data, final String charset)
 Converts the specified string to a byte array. More...
 
static byte[] getAsciiBytes (final String data)
 Converts the specified string to byte array of ASCII characters. More...
 
static String getAsciiString (final byte[] data, int offset, int length)
 Converts the byte array of ASCII characters to a string. More...
 
static String getAsciiString (final byte[] data)
 Converts the byte array of ASCII characters to a string. More...
 

Member Function Documentation

◆ getString() [1/2]

static String getString ( final byte[]  data,
int  offset,
int  length,
String  charset 
)
static

If the specified charset is not supported, default system encoding is used.

Parameters
datathe byte array to be encoded
offsetthe index of the first byte to encode
lengththe number of bytes to encode
charsetthe desired character encoding
Returns
The result of the conversion.

◆ getString() [2/2]

static String getString ( final byte[]  data,
final String  charset 
)
static

If the specified charset is not supported, default system encoding is used.

Parameters
datathe byte array to be encoded
charsetthe desired character encoding
Returns
The result of the conversion.

◆ getBytes()

static byte [] getBytes ( final String  data,
final String  charset 
)
static

If the charset is not supported the default system charset is used.

Parameters
datathe string to be encoded
charsetthe desired character encoding
Returns
The resulting byte array.

◆ getAsciiBytes()

static byte [] getAsciiBytes ( final String  data)
static
Parameters
datathe string to be encoded
Returns
The string as a byte array.

◆ getAsciiString() [1/2]

static String getAsciiString ( final byte[]  data,
int  offset,
int  length 
)
static

This method is to be used when decoding content of HTTP elements (such as response headers)

Parameters
datathe byte array to be encoded
offsetthe index of the first byte to encode
lengththe number of bytes to encode
Returns
The string representation of the byte array

◆ getAsciiString() [2/2]

static String getAsciiString ( final byte[]  data)
static

This method is to be used when decoding content of HTTP elements (such as response headers)

Parameters
datathe byte array to be encoded
Returns
The string representation of the byte array