Skip to content

Instantly share code, notes, and snippets.

@Marchuck
Last active Mar 5, 2016
Embed
What would you like to do?
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