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

com.liumapp.datapay.sms.tool.Convert Maven / Gradle / Ivy

There is a newer version: v2.0.5
Show newest version
package com.liumapp.datapay.sms.tool;

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

/**
 * Created by haoxy on 2018/11/3.
 * E-mail:[email protected]
 * github:https://github.com/haoxiaoyong1014
 */
public class Convert {
    public static String convertStreamToString(InputStream is) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(is));
        StringBuilder sb = new StringBuilder();

        String line = null;
        try {
            while ((line = reader.readLine()) != null) {
                sb.append(line + "\n");
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return sb.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy