Created
October 2, 2013 03:34
-
-
Save shikajiro/6788812 to your computer and use it in GitHub Desktop.
ストリームは開いたら必ず閉じる。
This file contains 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
InputStream in = null; | |
try { | |
// ②feedjsonを読み込む | |
in = getAssets().open("feed.json"); | |
BufferedReader buff = new BufferedReader(new InputStreamReader(in)); | |
StringBuilder bld = new StringBuilder(); | |
String line = null; | |
while ((line = buff.readLine()) != null) { | |
bld.append(line); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} finally { | |
//必ずcloseする。 | |
try { | |
in.close(); | |
} catch (IOException e) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment