android EncodingUtils类

public final class

EncodingUtils

extends Object
java.lang.Object
   ↳org.apache.http.util.EncodingUtils

Class Overview

The home for utility methods that handle various encoding tasks.

Summary

Public Methods
static byte[] getAsciiBytes( String data)
Converts the specified string to byte array of ASCII characters.
static String getAsciiString(byte[] data)
Converts the byte array of ASCII characters to a string.
static String getAsciiString(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 String getString(byte[] data, String charset)
Converts the byte array of HTTP content characters to a string.
static String getString(byte[] data, int offset, int length, String charset)
Converts the byte array of HTTP content characters to a string.
[Expand]
Inherited Methods
From class java.lang.Object
Object clone()
Creates and returns a copy of this Object.
boolean equals( Object o)
Compares this instance with the specified object and indicates if they are equal.
void finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
final Class<?> getClass()
Returns the unique instance of Class that represents this object's class.
int hashCode()
Returns an integer hash code for this object.
final void notify()
Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.
final void notifyAll()
Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.
String toString()
Returns a string containing a concise, human-readable description of this object.
final void wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
final void wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.
final void wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

Public Methods

public static byte[] getAsciiBytes (String data)

Since: API Level 1

Converts the specified string to byte array of ASCII characters.

Parameters
data the string to be encoded
Returns
  • The string as a byte array.

public static String getAsciiString (byte[] data)

Since: API Level 1

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)

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

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

Since: API Level 1

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)

Parameters
data the byte array to be encoded
offset the index of the first byte to encode
length the number of bytes to encode
Returns
  • The string representation of the byte array

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

Since: API Level 1

Converts the specified string to a byte array. If the charset is not supported the default system charset is used.

Parameters
data the string to be encoded
charset the desired character encoding
Returns
  • The resulting byte array.

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

Since: API Level 1

Converts the byte array of HTTP content characters to a string. If the specified charset is not supported, default system encoding is used.

Parameters
data the byte array to be encoded
charset the desired character encoding
Returns
  • The result of the conversion.

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

Since: API Level 1

Converts the byte array of HTTP content characters to a string. If the specified charset is not supported, default system encoding is used.

Parameters
data the byte array to be encoded
offset the index of the first byte to encode
length the number of bytes to encode
charset the desired character encoding
Returns
  • The result of the conversion. 
已标记关键词 清除标记
相关推荐
程序员的必经之路! 【限时优惠】 现在下单,还享四重好礼: 1、教学课件免费下载 2、课程案例代码免费下载 3、专属VIP学员群免费答疑 4、下单还送800元编程大礼包 【超实用课程内容】  根据《2019-2020年中国开发者调查报告》显示,超83%的开发者都在使用MySQL数据库。使用量大同时,掌握MySQL早已是运维、DBA的必备技能,甚至部分IT开发岗位也要求对数据库使用和原理有深入的了解和掌握。 学习编程,你可能会犹豫选择 C++ 还是 Java;入门数据科学,你可能会纠结于选择 Python 还是 R;但无论如何, MySQL 都是 IT 从业人员不可或缺的技能!   套餐中一共包含2门MySQL数据库必学的核心课程(共98课时)   课程1:《MySQL数据库从入门到实战应用》   课程2:《高性能MySQL实战课》   【哪些人适合学习这门课程?】  1)平时只接触了语言基础,并未学习任何数据库知识的人;  2)对MySQL掌握程度薄弱的人,课程可以让你更好发挥MySQL最佳性能; 3)想修炼更好的MySQL内功,工作中遇到高并发场景可以游刃有余; 4)被面试官打破沙锅问到底的问题问到怀疑人生的应聘者。 【课程主要讲哪些内容?】 课程一:《MySQL数据库从入门到实战应用》 主要从基础篇,SQL语言篇、MySQL进阶篇三个角度展开讲解,帮助大家更加高效的管理MySQL数据库。 课程二:《高性能MySQL实战课》主要从高可用篇、MySQL8.0新特性篇,性能优化篇,面试篇四个角度展开讲解,帮助大家发挥MySQL的最佳性能的优化方法,掌握如何处理海量业务数据和高并发请求 【你能收获到什么?】  1.基础再提高,针对MySQL核心知识点学透,用对; 2.能力再提高,日常工作中的代码换新貌,不怕问题; 3.面试再加分,巴不得面试官打破沙锅问到底,竞争力MAX。 【课程如何观看?】  1、登录CSDN学院 APP 在我的课程中进行学习; 2、移动端:CSDN 学院APP(注意不是CSDN APP哦)  本课程为录播课,课程永久有效观看时长 【资料开放】 课件、课程案例代码完全开放给你,你可以根据所学知识,自行修改、优化。  下载方式:电脑登录课程观看页面,点击右侧课件,可进行课程资料的打包下载。
©️2020 CSDN 皮肤主题: 成长之路 设计师:Amelia_0503 返回首页