1 package com.xtremelabs.robolectric.util; 2 3 import java.io.IOException; 4 import java.io.InputStream; 5 6 public class Strings { 7 8 public static String fromStream(InputStream inputStream) throws IOException { 9 int bufSize = 1028; 10 byte[] buffer = new byte[bufSize]; 11 int inSize; 12 StringBuilder stringBuilder = new StringBuilder(); 13 while ((inSize = inputStream.read(buffer)) > 0) { 14 stringBuilder.append(new String(buffer, 0, inSize)); 15 } 16 return stringBuilder.toString(); 17 } 18 19 public static boolean equals(String a, String b) { 20 if (a == null) { 21 return b == null; 22 } 23 return a.equals(b); 24 } 25 } 26