原文连接 http://www.apihome.cn/api/android/EncodingUtils.html

 

org.apache.http.util
类 EncodingUtils
java.lang.Object
  org.apache.http.util.EncodingUtils

 

public final class EncodingUtilsextends Object

The home for utility methods that handle various encoding tasks.

 


从以下版本开始:4.0作者:Michael Becke, Oleg Kalnichevski

 

 

方法摘要

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

从类 java.lang.Object 继承的方法

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

 

方法详细信息


getString
public static String getString(byte[] data,
                               int offset,
                               int length,
                               String charset)
Converts the byte array of HTTP content characters to a string. If the specified charset is not supported, default system encoding is used.

参数:data - the byte array to be encodedoffset - the index of the first byte to encodelength - the number of bytes to encodecharset - the desired character encoding返回:The result of the conversion.


getString
public static String getString(byte[] data,
                               String charset)
Converts the byte array of HTTP content characters to a string. If the specified charset is not supported, default system encoding is used.

参数:data - the byte array to be encodedcharset - the desired character encoding返回:The result of the conversion.


getBytes
public static byte[] getBytes(String data,
                              String charset)
Converts the specified string to a byte array.  If the charset is not supported the default system charset is used.

参数:data - the string to be encodedcharset - the desired character encoding返回:The resulting byte array.


getAsciiBytes
public static byte[] getAsciiBytes(String data)
Converts the specified string to byte array of ASCII characters.

参数:data - the string to be encoded返回:The string as a byte array.


getAsciiString
public static String getAsciiString(byte[] data,
                                    int offset,
                                    int length)
Converts the byte array of ASCII characters to a string. This method is to be used when decoding content of HTTP elements (such as response headers)

参数:data - the byte array to be encodedoffset - the index of the first byte to encodelength - the number of bytes to encode返回:The string representation of the byte array


getAsciiString
public static String getAsciiString(byte[] data)
Converts the byte array of ASCII characters to a string. This method isto be used when decoding content of HTTP elements (such as responseheaders)
参数:data - the byte array to be encoded返回:The string representation of the byte array

更多相关文章

  1. Android getResources().getColor() 过时 替代方法111
  2. Android点击事件方法
  3. canvas.drawRoundRect方法,绘制圆角矩形
  4. android抓log方法
  5. android 登陆右上角 的关闭按钮的使用方法
  6. Android AESUtils 工具类与调用方法
  7. sqlit导入外部数据库查找数据方法
  8. Android NDK打印log到logcat的方法
  9. Android获取系统时间的多种方法

随机推荐

  1. Python爬虫 - 抓取divnil动漫妹子图
  2. Android(安卓)Wifi 2.4G 5G附近扫描查看
  3. Android的体系结构
  4. 详解Android文件描述符
  5. android webview卡顿检测_Android性能优
  6. Android(安卓)图片加载(一)高效加载Bitmap
  7. kali 通过app渗透 android
  8. 知乎1578赞:Android(安卓)中为什么需要 Ha
  9. Android(安卓)RIL 架构学习总结
  10. 知乎1578赞:Android(安卓)中为什么需要 Ha