반응형
inputStream -> String
StringBuffer out = new StringBuffer();
byte[] b = new byte[4096];
for (int n; (n = inputStream.read(b)) != -1;) {
out.append(new String(b, 0, n));
}
out.toString();
-------------------------------------------------
String -> inputStream
InputStream bai = new ByteArrayInputStream(out.toString().getBytes("UTF-8"));
StringBuffer out = new StringBuffer();
byte[] b = new byte[4096];
for (int n; (n = inputStream.read(b)) != -1;) {
out.append(new String(b, 0, n));
}
out.toString();
-------------------------------------------------
String -> inputStream
InputStream bai = new ByteArrayInputStream(out.toString().getBytes("UTF-8"));
반응형
'프로그래밍 > Java' 카테고리의 다른 글
서블릿 설정 (0) | 2009.04.09 |
---|---|
[xml] xml parsing - SAXParseException (0) | 2009.03.13 |
jstl 예제 - fn, fmt, foreach (2) | 2009.02.18 |
JSTL (0) | 2009.02.18 |
[이클립스] JVM 메모리 용량 세팅 (0) | 2009.02.11 |