All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.niccolomattei.api.telegram.utils.Utils Maven / Gradle / Ivy

There is a newer version: 1.4_PRERELEASE-2
Show newest version
package me.niccolomattei.api.telegram.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * Created by Utente on 23/10/2015.
 */
public class Utils {

	public static String getStringFromInputStream(InputStream is) {

		BufferedReader br = null;
		StringBuilder sb = new StringBuilder();

		String line;
		try {

			br = new BufferedReader(new InputStreamReader(is));
			while ((line = br.readLine()) != null) {
				sb.append(line);
			}

		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if (br != null) {
				try {
					br.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
		return sb.toString();

	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy