java.io.BufferedReader.readLine()でinputStreemをStringに変換するコード

サンプルコード
public static String inputStreem2String(InputStream in) throws IOException{

BufferedReader reader =
new BufferedReader(new InputStreamReader(in, “UTF-8"));
StringBuffer buf = new StringBuffer();
String cftStr;
while ((cftStr = reader.readLine()) != null) {
buf.append(cftStr);
buf.append(“\n");
}
return buf.toString();
}

Java

Posted by arkgame