티스토리 뷰

프로그래밍

자바 byte[] to String,

앙망 2011. 3. 10. 14:10

 
byte[] 를 String으로 변환하기
byte[] fl_bd = (byte[])map.get("FL_BD");//내용 가져오기
String contents= new String(fl_bd,"MS949"); 


 java.lang.String.String(byte[] bytes, String charsetName) throws UnsupportedEncodingException


Constructs a new String by decoding the specified array of bytes using the specified 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 given charset is unspecified. The java.nio.charset.CharsetDecoder class should be used when more control over the decoding process is required.

Parameters:
bytes The bytes to be decoded into characters
charsetName The name of a supported charset
Throws:
UnsupportedEncodingException - If the named charset is not supported


댓글