2. 인터넷에서 대충 줒은거 개조했음.
public static void printByInputStream(InputStream is, String tgtMode) { byte[] buf = new byte[2048]; StringBuffer sb = new StringBuffer(); int len = -1; try { while ((len = is.read(buf, 0, buf.length)) != -1) { sb.append(new String(buf, 0, len)); } System.out.println(sb.toString()); if(tgtMode.equals("weather")){ parseWeather(sb.toString()); }else{ parseAir(sb.toString()); } } catch (IOException e) { e.printStackTrace(); } }
댓글 없음:
댓글 쓰기