package com.example.prettywallpapers.base;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;

public class Readmyfile {
    public static String getCovertStr(InputStream stream) {
        String covertStr = "";
        try {
            StringWriter writer = new StringWriter();
            char[] buffer = new char[stream.available()];
            Reader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
            int a = 0;
            while ((a = reader.read(buffer)) != -1) {
                writer.write(buffer, 0, a);
            }
            covertStr = writer.toString();
        } catch (IOException e) {
            return covertStr;
        }
        return covertStr;
    }

 /*   public static int dp2Px(int dp)  {
        float scale = Sounds.mAppContext.getResources().getDisplayMetrics().density;
        return (int) (dp * scale + 0.5f);
    }*/
}
