Skip to content

Instantly share code, notes, and snippets.

@Marchuck
Last active March 5, 2016 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marchuck/ab60f60495a09e5f6cb7 to your computer and use it in GitHub Desktop.
Save Marchuck/ab60f60495a09e5f6cb7 to your computer and use it in GitHub Desktop.
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));
}
}
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