Mega Code Archive

 
Categories / Android / File
 

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();     }      }