-
-
Save totem3/1427207 to your computer and use it in GitHub Desktop.
GetのResponseどうやって受け取れば。。(´・ω・`)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
import java.net._ | |
import sun.net.www.protocol.http.HttpURLConnection | |
val url = new URL("http://api.tabelog.com/Ver2.1/RestaurantSearch/?key=value") | |
val http = url.openConnection.asInstanceOf[HttpURLConnection] | |
http.setRequestMethod("GET") | |
http.connect | |
val bis = new BufferedInputStream(http.getInputStream) | |
val b = new Array[Byte](bis.available) | |
bis.read(b) | |
val baos = ByteArrayOutputStream | |
baos.write(b) | |
val res = baos.toString("utf-8") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
あ、、標準ライブラリにもそんな便利なものがありましたか。。。
勉強不足ですみません。
標準ライブラリ読みます(*´Д`)