JSP를 하다가 긴급질문입니다. byte[] 배열을 문자열로 변환해주세요...

shenyang2008의 이미지


안녕하세요?

JSP에서 byte[] 배열을 문자열로 변환해주세요...

byte[] 배열에는 유니코드문자열값이 들어있답니다.

이것을 String 형으로 좀 정확히 변환할려는데 잘 안되서...

좀 도와주십시요. 급합니다. 감사합니다.

uamyd5279의 이미지

import java.io.*;
...
...
byte[] data = new byte[DATA_SIZE];

long lTime = decode(data,8,4); //data의 8번째 Byte에서 4byte를 읽어서 long type으로 변환

...

이런 식으로 사용했습니다만...

----------------
"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life"-John 3:16

"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life"-John 3:16

rhheo의 이미지

try {
    String str = new String(byteData, "UTF-8")
} catch (UnsupportedEncodingException ex) {
    // 계속불가능한 에러 처리...
}