Last active
March 5, 2016 13:40
-
-
Save Marchuck/ab60f60495a09e5f6cb7 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
public static void logsOf(String veryLongString, int maxLogSize) { | |
for (int i = 0; i <= veryLongString.length() / maxLogSize; i++) { | |
int start = i * maxLogSize; | |
int end = (i + 1) * maxLogSize; | |
end = end > veryLongString.length() ? veryLongString.length() : end; | |
Log.v(TAG, veryLongString.substring(start, end)); | |
} | |
} |
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
static String response2String(retrofit.client.Response response) { | |
BufferedReader reader; | |
StringBuilder sb = new StringBuilder(); | |
try { | |
reader = new BufferedReader(new InputStreamReader(response.getBody().in())); | |
String line; | |
while ((line = reader.readLine()) != null) { | |
sb.append(line); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
String result = sb.toString(); | |
Log.d(TAG, result); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment