原文连接 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. 浅谈Java中Collections.sort对List排序的两种方法
  2. mybatisplus的坑 insert标签insert into select无参数问题的解决
  3. Python技巧匿名函数、回调函数和高阶函数
  4. Python list sort方法的具体使用
  5. python list.sort()根据多个关键字排序的方法实现
  6. Android(安卓)Touch事件分发机制学习
  7. Android之布局onClick属性写法规则
  8. Android(安卓)IntentService 分析
  9. android mediaplayer SurfaceView

随机推荐

  1. AIDL笔记
  2. Android Studio 编译提示 aapt.exe finis
  3. android中处理json最佳方法
  4. android 后台长时间执行周期性定时任务
  5. Algorithm_String: 字符串与EditText_01
  6. Android与ok6410板子tcp通信
  7. Android Studio中debug和release模式默认
  8. Android(安卓)- Activity 篇一
  9. Android ListView 效果美化
  10. Android(安卓)巧用 flexboxLayout 布局