Write InputStream into a StringBuilder : Stream « File « Android






Write InputStream into a StringBuilder

    
//package com.friendfeed.api;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.Collection;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

class FriendFeedUtils {


    public static void writeInputStream(InputStream ss, StringBuilder sb) throws IOException {
        byte[] buffer = new byte[2048];
        int length;
        while ((length = ss.read(buffer)) != -1) {
            sb.append(new String(buffer, 0, length));
        }
        ss.close();
    }
    


}

   
    
    
    
  








Related examples in the same category

1.Playing Back Audio Streams
2.Stream Proxy
3.Copy Stream
4.Ini File Stream Reader
5.Read InputStream fully to a string
6.Read Stream to byte array
7.read String From Stream
8.Read stream Fully
9.Read InputStream with ByteArrayOutputStream
10.get Resource As Stream, Loads the resource from classpath
11.InputStream to byte array, copy Reader and Writer,
12.InputStream that notifies listeners of its progress.
13.String to InputStream
14.Context.getFileStreamPath
15.stream To String
16.stream To Bytes
17.Load/save Int Map Data