Read string From BufferedReader - Android java.io

Android examples for java.io:BufferedReader

Description

Read string From BufferedReader

Demo Code

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Iterator;
import java.util.UUID;

public class Main{

    public static String stringFromBuffer(InputStream inputStream)
            throws IOException {
        StringBuilder stringBuilder = new StringBuilder();
        BufferedReader bufferedReader = new BufferedReader(
                new InputStreamReader(inputStream));

        String line;/*from  ww w .j  a  v a2  s.  c o  m*/
        while ((line = bufferedReader.readLine()) != null) {
            stringBuilder.append(line);
        }
        return stringBuilder.toString();
    }

}

Related Tutorials