String public String(byte[] bytes) Constructs a new String by decoding the specified array of bytes using the platform's default charset. The length of the new String is a function of the charset, and hence may not be equal to the length of the byte array. The behavior of this constructor when the given bytes are not valid in the default charset is unspecified. The CharsetDecoder class should be used when more control over the decoding process is required. Parameters: bytes - the bytes to be decoded into characters Throws: NullPointerException - if bytes is null Since: JDK1.1
对char[]可用String.copyValueOf(char[])
对byte[]有没有类似的方法???
好像没有String.copyValueOf(byte[])吧?!
public String(byte[] bytes)
Constructs a new String by decoding the specified array of bytes using the platform's default charset. The length of the new String is a function of the charset, and hence may not be equal to the length of the byte array.
The behavior of this constructor when the given bytes are not valid in the default charset is unspecified. The CharsetDecoder class should be used when more control over the decoding process is required.
Parameters:
bytes - the bytes to be decoded into characters
Throws:
NullPointerException - if bytes is null
Since:
JDK1.1